views:

309

answers:

1

we are looking for a way to find out (not modify, just find out) if our application has been allowed to receive notifications or not from our service. This probably requires read-only access to the "general settings" properties or some specific API's. Does anybody know how to get that information? I am talking about the info in iPhone --> Settings --> Notifications

For those who are interested, this is the rationale: we are having some issues with users pressing NO when asked to allow our application to receive push notifications. As you can imagine, users might just press no because they are racing through registration or because they don't quite understand what is happening, or simply because they are not too sure whether they should allow the application to get notifications. But then they forget they denied permission so file support requests because they don't receive push notifications.

+3  A: 

Call -[UIApplication enabledRemoteNotificationTypes]. From the docs:

The values in the returned bit mask indicate the types of notifications currently enabled for the application. These types are first set when the application calls the registerForRemoteNotificationTypes: method to register itself with Apple Push Notification Service. Thereafter, the user may modify these accepted notification types in the Notifications preference of the Settings application. This method returns those initial or modified values.

Ole Begemann
Note that enabledRemoteNotificationTypes is a instance method and should be called on the sharedApplication. (Just wanted to make sure someone doesn't copy paste and then complain it doesn't work)
Brandon Bodnár
Top Banana! that's exactly what I needed, thank you!BTW, as Brandon says, the code if someone doesnt' know how to get to the current application instance, is:[[UIApplication sharedApplication] enabledRemoteNotificationTypes]
Marco