NMPushManagerDelegate Protocol Reference
| Conforms to | NSObject |
| Declared in | NMPushManager.h |
Overview
NMPushManagerDelegate protocol defines methods to track and decide what to do when a push notification is received. You should implement these methods to have advanced control over push notification handling process.
Warning: Currently, if a push notification that is sent from Netmera is received, default remote notification delegate methods are also called in addition to NMPushManagerDelegate protocol methods. THIS BEHAVIOR WILL BE CHANGED IN THE NEXT MAJOR RELEASE. If the push notification is sent via Netmera, only NMPushManagerDelegate methods will be called. Therefore, you should update your code and start to use NMPushManagerDelegate methods to manage push notification handling for notifications coming from Netmera.
Tasks
-
– didReceivePush:appState:Called whenever a push notification is received. This method will NOT be called if didReceivePush:appState:fetchCompletionHandler: method is implemented.
-
– didReceivePush:appState:fetchCompletionHandler:Called whenever a push notification is received. This method overrides didReceivePush:appState: method.
-
– handleActionForPush:appState:completionHandler:Called when your app has been activated by the user via selecting an action from an interactive push notification. You can check push.actionIdentifier value to get action identifier of the touched action button.
-
– shouldPresentRichPush:Method that asks whether received rich push notification should be presented by Netmera SDK automatically.
-
– shouldPresentInteractivePushInForeground:If an interactive push is received when app is foreground, SDK present an alert containing action buttons to user by default. To disable this, implement this method and return NO.
Instance Methods
didReceivePush:appState:
Called whenever a push notification is received. This method will NOT be called if didReceivePush:appState:fetchCompletionHandler: method is implemented.
- (void)didReceivePush:(NMPushObject *)push appState:(NMAppState)stateParameters
- push
Push object that is received. It may be an NMPushObject or an NMRichPushObject. You can check via type property of NMPushObject class.
- state
An enum value that describes the state when app has received given push notification. For possible values, see NMAppState.
Discussion
Called whenever a push notification is received. This method will NOT be called if didReceivePush:appState:fetchCompletionHandler: method is implemented.
Note: You can implement this method instead of didReceivePush:appState:fetchCompletionHandler: if you do not enable “remote-notification” background mode.
Declared In
NMPushManager.hdidReceivePush:appState:fetchCompletionHandler:
Called whenever a push notification is received. This method overrides didReceivePush:appState: method.
- (void)didReceivePush:(NMPushObject *)push appState:(NMAppState)state fetchCompletionHandler:(void ( ^ ) ( UIBackgroundFetchResult result ))completionHandlerParameters
- push
Push object that is received. It may be an NMPushObject or an NMRichPushObject. You can check via type property of NMPushObject class.
- state
An enum value that describes the state when app has received given push notification. For possible values, see NMAppState.
- completionHandler
You should call the completionHandler as soon as you’re finished your task, so the system can accurately estimate its power and data cost.
Discussion
Note: You should implement this method if you enable “remote-notification” background mode.
Declared In
NMPushManager.hhandleActionForPush:appState:completionHandler:
Called when your app has been activated by the user via selecting an action from an interactive push notification. You can check push.actionIdentifier value to get action identifier of the touched action button.
- (void)handleActionForPush:(NMPushObject *)push appState:(NMAppState)state completionHandler:(void ( ^ ) ( ))completionHandlerParameters
- push
Push object that is received. You can get parameters set to the action from Netmera panel via push.actionParams property.
- state
An enum value that describes the state when app has received given push notification. For possible values, see NMAppState.
- completionHandler
You should call the completion handler as soon as you’ve finished handling the action.
Discussion
Note: You should implement this method if you are using interactive notifications in your application.
Declared In
NMPushManager.hshouldPresentInteractivePushInForeground:
If an interactive push is received when app is foreground, SDK present an alert containing action buttons to user by default. To disable this, implement this method and return NO.
- (BOOL)shouldPresentInteractivePushInForeground:(NMPushObject *)pushParameters
- push
Received interactive push notification.
Return Value
Boolean value to determine if SDK should automatically present an alert.
Discussion
If an interactive push is received when app is foreground, SDK present an alert containing action buttons to user by default. To disable this, implement this method and return NO.
Declared In
NMPushManager.hshouldPresentRichPush:
Method that asks whether received rich push notification should be presented by Netmera SDK automatically.
- (BOOL)shouldPresentRichPush:(NMRichPushObject *)richPushParameters
- richPush
Rich push object that is received.
Return Value
A boolean value which determines if given rich push should be presented by SDK automatically.
Discussion
Method that asks whether received rich push notification should be presented by Netmera SDK automatically.
Note: If you do NOT implement this method, SDK will automatically present received rich push notifications considering preferences set in NetmeraSettings.plist file. You should implement this method and return NO if you want to handle presentation of received rich push notications yourself.
Declared In
NMPushManager.h