How to enable push notification types from settings bundle when registering for push notification?
-
19-09-2019 - |
Question
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?
Solution
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow