Managing Push Notifications

The Netmera iOS SDK allows developers to control push notification delivery from within the app, based on user preferences.

// Enables receiving Netmera push notifications
Netmera.setReceivingPushNotificationsEnabled(true)
// Disables receiving Netmera push notifications
Netmera.setReceivingPushNotificationsEnabled(false)

Checking Push Notification Status

You can check whether the device is currently able to receive push notifications using the following code snippet:

// Check current push notification status using Netmera
Netmera.isReceivingPushNotificationsEnabled { [weak self] isEnabled in
    DispatchQueue.main.async {
        self?.pushSwitch.isOn = isEnabled
    }
}

Explanation

  • The isReceivingPushNotificationsEnabled method returns a boolean indicating whether the device can currently receive push notifications via Netmera.

  • If the result is true, push notifications are allowed. If false, they are blocked or disabled.

  • This value can be directly reflected in the UI, for example by updating a UISwitch.

Last updated

Was this helpful?