Push Notification Permissions

System Permissions

Step 1 : Enable Push Notifications in Xcode

To enable push notifications for your app, follow these steps:

  • Open your Xcode project.

  • Navigate to Signing & Capabilities.

  • Under Capability, select Push Notifications.

Step 2: Requesting Notification Permission

To request notification permission, call the requestPushNotificationAuthorization() method.

Important Notes:

In Android 13 (API 33) and higher, runtime notification permissions are required for push notifications. If you don't request notification permission at runtime, you can use the requestPushNotificationAuthorization() method from Netmera to request permission from the user.

  • Target API 33 or above: Make sure your Android project is targeting API 33 or above, as runtime permissions are required starting from Android 13.

  • User Consent: Always inform users why you are requesting permission to send notifications, and provide them with the option to grant or deny the permission.

  • Permission Flow: You can handle different behaviors based on whether the user has granted or denied the permission.

Checking Notification Permission Status

If you need to check whether the user has granted or denied notification permissions, you can use the checkNotificationPermission() method. This returns an enum of the current status of the notification permission.

Responses

When this method is called, it would return one of the following responses:

  1. NOTDETERMINED The user has opened the app but hasn't made a decision about notification permissions yet.

  2. BLOCKED The user has disabled notifications for the app at the system level. Even if the app tries to request permission, it will be automatically restricted by the OS.

  3. GRANTED The user has granted notification permission, and the app can send notifications.

  4. DENIED The user has denied permission or has blocked notifications through system settings.

Netmera Push Opt-In Status

Netmera also controls whether a device is eligible to receive push notifications:

  • Netmera.enablePush(); Sets the device’s status to active (opt-in) in the Netmera system. The device is included in the deliverable audience for push campaigns.

  • Netmera.disablePush(); Sets the device’s status to inactive (opt-out) in the Netmera system. Netmera will not send push notifications, even if OS-level permissions are enabled.

Last updated

Was this helpful?