How to unregister notifications in expo

Hi

Is there a reason why PushNotificationsIOS.abandonPermissions() not available in expo?

In case of the issues like https://github.com/expo/expo/issues/2648, Looks like this command may help to reset notifications permissions.

I am facing the issue https://github.com/expo/expo/issues/2648 and trying to RESET/UNREGISTER Notification Permissions…

abandonPermissions()
PushNotificationIOS.abandonPermissions();
Unregister for all remote notifications received via Apple Push Notification service.
You should call this method in rare circumstances only, such as when a new version of the app removes support for all types of remote notifications. Users can temporarily prevent apps from receiving remote notifications through the Notifications section of the Settings app. Apps unregistered through this method can always re-register.`

[IOS][Standalone][Production]

Please Help!

Expo uses a different push notification system, which is why that function is not available.

The GitHub issue you linked goes to a blank page, so I am probably missing information here, but PushNotificationIOS.abandonPermissions() unregisters the device with APNs. It does not reset the permissions state of the device, despite its name.

See Apple’s documentation for how to reset permissions on iOS (copied here):

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.

From Technical Note TN2265: Troubleshooting Push Notifications

Hi expo Team,

Thank you for response.

Please see the link [IOS][PRODUCTION] getAsync is granted, getExpoPushTokenAsync throws error . In case of any issues like this, It may be needed to have a way to reset the permissions. The Apple documentation is too much technical for end users to reset it.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.