2

Consider this situation. The app runs and application:didRegisterForRemoteNotificationsWithDeviceToken: receives information that the app is authorized to receive push notifications.

User puts app to background and removes app's authorization to receive notifications on the device's configuration.

User runs app again. Returning from background, the app still thinks it has authorization to receive push notifications. Neither application:didRegisterForRemoteNotificationsWithDeviceToken: or application:didFailToRegisterForRemoteNotificationsWithError: receives anything at this point.

Is there a way to know at any given point if an app has authorization to receive push notifications (reading something from device's notification preferences)?

thanks.

Duck
  • 32,792
  • 46
  • 221
  • 426
  • 1
    possible duplicate of http://stackoverflow.com/questions/7898752/ios-check-for-push-notification-support-in-the-app (you can check whether user have selected to receive push-notifications when the app returns from background) – Rox Dorentus Jan 25 '13 at 13:04
  • fantastic! thanks. Please put this as an answer, so I can accept. Just one final question. Once I have verified that the user has it disabled is there a way to programmatically direct the user to the notification settings on the device's configuration? – Duck Jan 25 '13 at 13:11

1 Answers1

5

You can check for [[UIApplication sharedApplication] enabledRemoteNotificationTypes] each time the app returns from background.

See: iOS - Check for push notification support in the app

Once I have verified that the user has it disabled is there a way to programmatically direct the user to the notification settings on the device's configuration?

No for newer iOS versions. According to Navigate to settings screen in iphone and iOS Launching Settings -> Restrictions URL Scheme, you can use -[[UIApplication sharedApplication] openURL:] to navigate to settings screen, but only on devices running iOS version 5.0 and prior.

Community
  • 1
  • 1
Rox Dorentus
  • 3,585
  • 2
  • 22
  • 47