How to detect user not allowing notifications in iOS

How do you detect if a user taps ‘Don’t allow’ when the push notification message pops up on an iPhone when an app launches?

In iOS 7, when the system’s push notification prompt appears, the app becomes inactive and UIApplicationWillResignActiveNotification fires. Similarly when the user responds to the prompt (pressing either Yes or No), the app becomes active again and UIApplicationDidBecomeActiveNotification fires.

So you can listen for this notification, and then hide your loading screen.

Note: While the prompt is displayed, the Home button, Notification Center, and Control Center are disabled so they cannot trigger a false-positive UIApplicationDidBecomeActiveNotification. However if the user presses Lock button it will trigger UIApplicationDidBecomeActiveNotification.
IOS9 is more complicated,check here:

1 Like

Thanks, Tim.
I was actually looking for the Ionic code for detecting a “don’t allow” response in Ionic. I need to execute different functions based on the user’s selection (“allow” or “don’t allow”). Any idea how to do it in Ionic?