1. Redirect users to the phone's settings
On iOS, redirecting users to the phone's settings is the only 100% reliable way to disable push notifications.
You can use the
BatchPush openSystemNotificationSettings (Objective C) or the
BatchPush.openSystemNotificationSettings() (Swift) method.
Note: You can implement a toggle switch that will direct users to the system settings when users click it to disable/enable push notifications. In order to get the right toggle switch state, use the following method.
2. Take advantage of Batch's segmentation engine
However, some apps offer to disable push notifications directly in the app.
A. Tag users' optin status
Create a boolean optin_push_app attribute, true when your user has activated push notifications in the app's settings, false when he disabled them.
B. Use this attribute in all your campaign's segmentation
Whenever you create a campaign, include this attribute in your targeting.
Before you choose to use this method, please consider the following points:
This method is network dependent. If the user is not connected to the Internet, the push notifications' disabling will not be immediate.
It can be a source of errors. If you forget to include the attribute in your targeting, you will send notifications to users who indicated they did not want to receive push notifications.