0
votes

On IOS - Notification opens browser v/s app.

Using one-signal for notification. branch URL is set as additional data on the notification. Grabbing this back in OneSignalHandleNotificationBlock and direct your webview to it.

Saw in the dev notes for Branch that one way to make this work is -

You can use Branch links with push notifications. When creating a push notification, you should specify the Branch link in the userInfo dictionary. It should be an NSString, and the key in userInfo should be Branch. Example: @{ @"branch" : @"https://[branchsubdomain]/ALMc/e03OVEJLUq" }

And then setting up didReceiveRemoteNotification - - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { [[Branch getInstance] handlePushNotification:userInfo];

// ... handle push notifications that do not include Branch links

}

I have not been able to make this work.

Anyone else faced something similar before - handing branch URL in one-signal notifications?

For folks with experience in OneSignal - How to send this key:value pair in Apple Push Notification Payload as branch:"branch_link"?

For folks with experience in Branch - How is branch expecting it in the Apple Push Notification Payload.

1
So it appears that in IOS if the app not running - application:didFinishLaunchingWithOptions is called upon a notification. And when the app is active or running in the background - application:didReceiveRemoteNotification is called upon a notification.Sharad
1) ​​So should we add OneSignalHandleNotificationBlock​ to both the above methods?​ And here we retrieve the URL from the additional data?Sharad
2) ​So should we add [[Branch getInstance] handlePushNotification:userInfo];​ to both the above methods?​Sharad
3) ​Biggest confusion is - how should be handle the Branch requirement of You can use Branch links with push notifications. When creating a push notification, you should specify the Branch link in the userInfo dictionary. It should be an NSString, and the key in userInfo should be Branch. So, for example:@{ @"branch" :@"https://[branchsubdomain]/ALMc/e03OVEJLUq" }.Sharad
4) ​Question - ​How can we customize the notification data in such a way that their SDK can parse it, through their suggested Example: @{ @"branch" : @"https://[branchsubdomain]/ALMc/e03OVEJLUq" }​?Sharad

1 Answers

0
votes

Currently, OneSignal does not natively support deep linking. I had a personal look at the Branch SDK and how they integrate with OneSignal. For the most part, the two SDKs can work side by side without any issue. When it comes to sending deep links within push notifications, going with Branch's implementation will require you to customize the notification data in such a way that their SDK can parse it, through their suggested
Example: @{ @"branch" : @"https://[branchsubdomain]/ALMc/e03OVEJLUq" }.

What I would recommend for the moment being is sending the relevant data as additionalData part of the create notification api and handle the response within the OneSignalHandleNotificationBlock by either redirecting to a specific view within the app (if deep linking to self), or else opening the link in Safari through UIApplication openURL method as it is generally safer to do so than in an embedded UIWebView.