How to Get Back "Allow Push Notifications" Dialog After It Was Dismissed Once

How to get back Allow Push Notifications dialog after it was dismissed once?

Here's how Apple say you can do it:

Resetting the Push Notifications Permissions Alert on iOS

The first time a push-enabled app registers for push notifications,
iOS asks the user if they wish to receive notifications for that app.
Once the user has responded to this alert it is not presented again
unless the device is restored or the app has been uninstalled for at
least a day.

If you want to simulate a first-time run of your app, you can leave
the app uninstalled for a day. You can achieve the latter without
actually waiting a day by following these steps:

  1. Delete your app from the device.

  2. Turn the device off completely and turn it back on.

  3. Go to Settings > General > Date & Time and set the date ahead a day or more.

  4. Turn the device off completely again and turn it back on.

Reset push notification settings for app

Technical Note TN2265: Troubleshooting Push Notifications

The first time a push-enabled app
registers for push notifications, iOS
asks the user if they wish to receive
notifications for that app. Once the
user has responded to this alert it is
not presented again unless the device
is restored or the app has been
uninstalled for at least a day.

If you want to simulate a first-time
run of your app, you can leave the app
uninstalled for a day. You can achieve
the latter without actually waiting a
day by setting the system clock
forward a day or more, turning the
device off completely, then turning
the device back on.

Update: As noted in the comments below, this solution stopped working since iOS 5.1. I would encourage filing a bug with Apple so they can update their documentation. The current solution seems to be resetting the device's content and settings.

Update: The tech note has been updated with new steps that work correctly as of iOS 7.

  1. Delete your app from the device.
  2. Turn the device off completely and turn it back on.
  3. Go to Settings > General > Date & Time and set the date ahead a day or more.
  4. Turn the device off completely again and turn it back on.

UPDATE as of iOS 9

Simply deleting and reinstalling the app will reset the notification status to notDetermined (meaning prompts will appear).

Thanks to the answer by Gomfucius below:
https://stackoverflow.com/a/33247900/704803

Callback Method if user declines Push Notification Prompt?

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.

How to run code after showDialog is dismissed in Flutter?

Simply use await or then. the code in then block will be run after the dialog is dismissed.

showDialog(
// Your Dialog Code
).then((val){
Navigator.pop(_context);
});


Related Topics



Leave a reply



Submit