The very first time you start a push app, the user gets asked if he wants to allow push notifications.
the problem here is, that didRegisterForRemoteNotificationsWithDeviceToken gets called before the user made a decision, so the enabledRemoteNotificationTypes are all disabled before the user clicks a button.
i register the device on my server for push messages in this didRegisterForRemoteNotificationsWithDeviceToken method, so the very first time i get a user that disabled all notifications, although the user probably clicked “allow” a few seconds later.
the next startup this information gets updated, but as long as a user doesn’t restart the app (which can take a long time in times of multitasking) i’m unable to send this person a push message.
does somebody have a tip for me? is there a better place to update my server with the user settings. is there probably a callback from the popup that appears the very frist time?
thanks for all hints!
You shouldn’t track the enabled notification types on your server. When a user disables a certain type of notification for your app, e.g. sounds, your notification can still contain a sound key, but the device won’t play it.
The problem is that a user could (re-)enable any notification types for your app while it’s not running, so your server wouldn’t have a chance to notice the change and you wouldn’t deliver notifications, even though the user expects them.