-
Notifications
You must be signed in to change notification settings - Fork 21
How to completely stop or start receiving push messages
Push registration is enabled by default, that means that you don't need to use method for enabling it. Disabled push registration is the one that will completely stop receiving push notifications. Disabling push registration is needed to be used only if you want to opt out of receiving notifications. If you just don't want notifications to be displayed in the notification center, you can send silent campaigns.
In order to disable the current user from receiving push messages, you have to change his push registration status. Here are the steps:
- Start MobileMessaging SDK in a way it's described in the Quick Start Guide if it is not started yet.
- Once the SDK has been successfully initialized and started, do the following:
if let installation = MobileMessaging.getInstallation() {
installation.isPushRegistrationEnabled = false
MobileMessaging.saveInstallation(installation, completion: { error in
if let error = error {
< handle error if not nil >
}
})
}
In order to enable current user back to receiving push messages, you enable user's push registration:
- Start MobileMessaging SDK in a way it's described in the Quick Start Guide if it is not started yet.
- Once the SDK has been successfully initialized and started, do the following:
if let installation = MobileMessaging.getInstallation() {
installation.isPushRegistrationEnabled = false
MobileMessaging.saveInstallation(installation, completion: { error in
if let error = error {
< handle error if not nil >
}
})
}
In order to get the current registration status, use the following code:
let isPushRegistrationEnabled = MobileMessaging.getInstallation().isPushRegistrationEnabled
If you have any questions or suggestions, feel free to send an email to support@infobip.com or create an issue.
- Library events
- Server errors
- Users and installations
- Messages and notifications management
- Inbox
- Geofencing service
- Privacy settings
- In-app chat
- WebRTC Calls and UI