2

I want to send silent notifications to my users (receive in background - not alert, sound or badge). I checked the Remote Notifications option in Xcode's Background Modes.

My question is - do I still need to register for remote notifications using [UIApplication sharedApplication] registerForRemoteNotificationTypes? If so - what type should I use? None of them looks like "Silent Notifications":

  • UIRemoteNotificationTypeNone
  • UIRemoteNotificationTypeBadge
  • UIRemoteNotificationTypeSound
  • UIRemoteNotificationTypeAlert
  • UIRemoteNotificationTypeNewsstandContentAvailability

What is the correct way to do this?

YogevSitton
  • 10,068
  • 11
  • 62
  • 95

1 Answers1

-2

Ya you can do it:

But ask your backend developer to sent notification like following empty sound file:

{
"aps" : {
     "sound" : "nothiong.cif"
}
}

It will display notification without sound.

Note: The sound file not must in App bundle.

PREMKUMAR
  • 8,283
  • 8
  • 28
  • 51
  • Do I have to use registerForRemoteNotificationTypes? – YogevSitton Sep 08 '14 at 09:43
  • Yes. You must do. else it will display default notification sound. [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)]; – PREMKUMAR Sep 08 '14 at 09:44
  • What is the purpose of the Capabilities->Background Modes->Remote Notifications section in Xcode then - if I still need to register for notifications? – YogevSitton Sep 08 '14 at 09:47
  • This link explains everything: http://www.g8production.com/post/72656082173/ios7-multitasking-silent-notifications – YogevSitton Sep 08 '14 at 09:50
  • Ya great. But I am still using empty file code for one of my project. – PREMKUMAR Sep 08 '14 at 09:53