views:

241

answers:

1

I have created settings bundle and also three switches for alert,sound and badge.i am also getting 0 or 1 according to switch(On/Off).Now how do i enable only selected notification types when calling this method

  [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(here i want to set types from settings)];

how do i set types?

+1  A: 

You can just pass one (or the OR of multiple) UIRemoteNotificationType, like

[[UIApplication sharedApplication] 
     registerForRemoteNotificationTypes:
         (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];

I recommend that you enable all the types here. This would create a new settings for the App under Push Notification settings in the Settings app, which is the standard place for user configuration of push notification.

I would argue against having your own configuration in your app settings bundle.

notnoop
You mean if i enable these three types the app automatically creates those three switches for pushnotification setting in settings app?
Rahul Vyas
Correct and the user can then disable the undesirable notification types there.
notnoop