Opt-in/Opt-out methods within your app's setting screen, so the user can switch on/off option of receiving Push Notifications.
Objective-C
Code Block |
---|
/**/ Disable and re-enable Push Notifications. @brief Method will disable or re-enable Push Notification per device at Appoxee Dashboard. @attention Method does not un-register from push notifications, but rather, it opts-out the device from Push Services at Appoxee Dashboard. @code & Enable [[Appoxee shared] disablePushNotifications:booleanArgument withCompletionHandler:^(NSError *appoxeeError, id data) { if (!appoxeeError) { // operation was successful. } }]; @endcode @param// isDisabled BOOL value indacating if should enableState (enabled or disable push. @param handler Code Block to be executed when method completes with an NSError object and data as arguments. */ - (void)disablePushNotifications:(BOOL)isDisabled withCompletionHandler:(nullable AppoxeeCompletionHandler)handler; /** Get the current state of the push from Appoxee dashboard. @brief Method to get the state value of the push status from Appoxee Dashboard. @attention Method indicates if a device is push-enabled at Appoxee dashboard, and not if a device is registered for APNS. @code [[Appoxee shared] isPushEnabled:^(NSError *appoxeeError, id data) { if (!appoxeeError) { BOOL state = [(NSNumber *)data boolValue]; } }]; @endcode @param handler Code Block to be executed when method completes with an NSError object and data as arguments. */ - (void)isPushEnabled:(nullable AppoxeeCompletionHandler)handler;disabled) [[Appoxee shared] isPushEnabled:^(NSError *appoxeeError, id data) { if (!appoxeeError) { BOOL state = [(NSNumber *)data boolValue]; } }]; |
Swift
Code Block |
---|
Appoxee.shared()?.disablePushNotifications(booleanArgument, withCompletionHandler: { (appoxeeError, data) in
if appoxeeError == nil {
// Operation was successful.
}
})
Appoxee.shared()?.isPushEnabled({ (appoxeeError, data) in
if appoxeeError == nil {
let isEnabled = data as? NSNumber
}
}) |