只需要確認。如果我使用了靜默推送通知服務(如用於詢問何時使用推送通知),應用程序是否會請求用戶權限?任何幫助,將不勝感激無聲推送通知
Q
無聲推送通知
2
A
回答
2
0
對於必須設置JSON像這樣的(PHP文件)沉默推,
$body['aps'] = array(
'sound' => '',
'content-available' => 1
);
不發送警報和徽章。
在Xcode文件選擇目標 - >能力和啓用後臺模式,在appdelegate.m文件打勾遠程通知
只使用該消息接收無聲推
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
{
//Success this method will automatically call when device receives push notification
handler(UIBackgroundFetchResultNewData);
}
// eg code to register for apps
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge
|UIRemoteNotificationTypeSound
|UIRemoteNotificationTypeAlert) categories:nil];
[application registerUserNotificationSettings:settings];
} else {
UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound;
[application registerForRemoteNotificationTypes:myTypes];
}
return YES;
}
#ifdef __IPHONE_8_0
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
//register to receive notifications
[application registerForRemoteNotifications];
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler
{
//handle the actions
if ([identifier isEqualToString:@"declineAction"]){
}
else if ([identifier isEqualToString:@"answerAction"]){
}
}
#endif
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
NSLog(@"My token is: %@", deviceToken);
}
- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
NSLog(@"Failed to get token, error: %@", error);
}
相關問題
- 1. 無聲推送通知
- 2. 無聲推送通知與正常推送通知
- 3. iOS - 無聲推送通知發送值
- 4. iOS 8.1推送通知無聲音
- 5. 聲音推送通知
- 6. iPhone推送通知的聲音,「聲音通知」
- 7. 無Apple推送通知服務的推送通知?
- 8. 無效的推送通知
- 9. 推送推送通知
- 10. 啓用聲音的JavaPNS推送通知
- 11. 如何更改推送通知聲音?
- 12. 推送通知中的聲音iPhone
- 13. 推送通知 - 聲音不工作?
- 14. Android Mixpanel推送通知聲音
- 15. 反應本機推送通知聲音
- 16. IOS推送通知聲音不工作
- 17. iPhone推送通知聲音的限制?
- 18. 推送通知:聲音和徽章
- 19. 推送通知的自定義聲音
- 20. 蘋果推送通知聲音
- 21. Localytics android推送消息通知聲音
- 22. 本地推送通知啓用聲音
- 23. 讓蜂鳴聲收到推送通知
- 24. 推送通知的另一個聲音
- 25. 停止播放聲音推送通知
- 26. 更改推送通知聲音
- 27. 用聲音接收推送通知
- 28. iOS推送通知自定義聲音
- 29. 推送通知聲音不起作用
- 30. 推送通知
是的,它會要求確保 – Retro
你可以發送關於它的任何教程鏈接。 – Avinash
看這裏http://hayageek.com/ios-silent-push-notifications/並檢查WWDC vedios – Retro