We have multiple push providers and are having push handling issues.
You might have other push providers inside the project. As long as the services that provide the messaging functionalities have their own notification integration procedures and steps, they may interfere with Insider’s. To prevent this, you should separate Insider’s notification handling from the other providers.
Insider One's push notifications have unique identifiers that can be separately handled.
You should handle the notification and providers where the project first receives the notification. In this case, iOS receives the push notification with the didReceiveRemoteNotification method inside the AppDelegate file in the iOS project. See the code below for an example:
override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let currentState = application.applicationState
if (currentState == UIApplication.State.inactive || currentState == UIApplication.State.background) {
somePartnerObject?.whenReceivedMessage("onMessage", arguments: userInfo)
} else {
// handle push data here when app is in foreground
}
if (somePartnerCondition == true) {
completionHandler(.noData)
return
}
super.application(application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler)
}The sample code above handles the push notifications with methods from another provider’s object, which will also handle Insider’s.
You should distinguish between these handling methods. See below for the code snippet:
override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let currentState = application.applicationState
if (currentState == UIApplication.State.inactive || currentState == UIApplication.State.background) {
if (userInfo["source"] as? String == "Insider") {
Insider.handlePushLog(userInfo: userInfo)
return;
}
somePartnerObject?.whenReceivedMessage("onMessage", arguments: userInfo)
} else {
// handle push data here when app is in foreground
}
if (somePartnerCondition == true) {
completionHandler(.noData)
return
}
super.application(application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler)
}The example above recognizes the Insider notification. Each notification received from Insider has the identifier in the key “source” insider userInfo Dictionary. The key’s value equals “Insider” if the provider is Insider. You can check this information to handle your further actions. The example also includes an early return statement to prevent the notification from being handled twice. If it is handled twice, it might cause functionality issues.
The following are the methods for handling Insider Notifications for other languages:
Android Native SDK Signature
public void handleFCMNotification(Context context, RemoteMessage message)
public void handleHMSNotification(Context context, com.huawei.hms.push.RemoteMessage message):
Android Native SDK Example
Insider.Instance.handleFCMNotification(getApplicationContext(), message)
Insider.Instance.handleHMSNotification(getApplicationContext(), message);iOS Native SDK Signature
+ (void)handlePushLogWithUserInfo:(NSDictionary *)userInfo;iOS Native SDK Example
(Depends on your handling)[Insider handlePushLogWithUserInfo:userInfo];
[Insider handlePushLogWithUserInfo:notification.request.content.userInfo];
[Insider
handlePushLogWithUserInfo:response.notification.request.content.userInfo];
React Native SDK Signature
static handleNotification(notification)
React Native SDK Example
RNInsider.handleNotification(notification);Flutter SDK Signature
Future<void> handleNotification(Map<String, dynamic> notification)Flutter SDK Example
await FlutterInsider.Instance.handleNotification(notification);