Closed KirstenStake closed 3 years ago
@KirstenStake this should be related. Are you integrating push on iOS via our automatic integration or a manual integration (you can check the value of your com.appboy.ios_disable_automatic_push_registration
flag in config.xml
to confirm.
If deep links and direct opens are not working, the push delegates that send push lifecycle events to Braze are probably not working, either because the user notifications delegate wasn't set properly or they aren't implemented.
@Bucimis thanks for your quick reply!
This is our setup around the plugin:
Our config.xml looks like this (XXXXX being our personal info values):
<preference name="com.appboy.api_key" value="XXXXX" />
<preference name="com.appboy.firebase_cloud_messaging_registration_enabled" value="true" />
<preference name="com.appboy.android_handle_push_deep_links_automatically" value="true" />
<preference name="com.appboy.android_small_notification_icon" value="XXXXX" />
<preference name="com.appboy.android_large_notification_icon" value="XXXXX" />
<preference name="com.appboy.android_notification_accent_color" value="#F6443A" />
<preference name="com.appboy.android_api_endpoint" value="XXXXX" />
<preference name="com.appboy.android_fcm_sender_id" value="XXXXX" />
<preference name="com.appboy.android_default_session_timeout" value="str_5" />
<preference name="com.appboy.android_log_level" value="0" />
<preference name="com.appboy.ios_disable_automatic_push_registration" value="NO" />
<preference name="com.appboy.ios_enable_idfa_automatic_collection" value="NO" />
<preference name="com.appboy.ios_api_endpoint" value="XXXXX" />
@KirstenStake are you using any other plugins that implement iOS push, such as Firebase?
@Bucimis No, no other push plugins.
For reference the code that was added for custom prompt for push function was this (in case you can see something that might be missing to register or set up something)
- (void)promptForPush:(CDVInvokedUrlCommand *)command {
UIUserNotificationType notificationSettingTypes = (UIUserNotificationTypeBadge | UIUserNotificationTypeAlert | UIUserNotificationTypeSound);
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) {
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
// If the delegate hasn't been set yet, set it here in the plugin
// if (center.delegate == nil) {
// center.delegate = [UIApplication sharedApplication].delegate;
// }
UNAuthorizationOptions options = UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge;
if (@available(iOS 12.0, *)) {
// options = options | UNAuthorizationOptionProvisional;
}
[center requestAuthorizationWithOptions:options
completionHandler:^(BOOL granted, NSError *_Nullable error) {
NSLog(@"Permission granted.");
NSLog(@"Permission granted.");
[[Appboy sharedInstance] pushAuthorizationFromUserNotificationCenter:granted];
}];
[[UIApplication sharedApplication] registerForRemoteNotifications];
NSString* callbackId = command.callbackId;
NSString* packageName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:packageName];
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
} else if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_7_1) {
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:notificationSettingTypes categories:nil];
[[UIApplication sharedApplication] registerForRemoteNotifications];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
} else {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: notificationSettingTypes];
}
}
And the three functions we use in the app for ay linkage to appboy plugin are:
Our target SDK is 12.
There are some warnings in xCode during build for AppBoy plugin, will paste them here in case anything stands out?
@KirstenStake that delegate code that is commented out is likely causing issues. You need to set the UNUserNotificationCenter
delegate using center.delegate = <your-delegate-instance-here>
to receive lifecycle events. Your delegate instance needs to implement UNUserNotificationCenter delegate methods and pass those to Braze. See https://github.com/Appboy/appboy-ios-sdk/blob/41de83d15a755af3819287b06d4efc0ec855792a/HelloSwift/HelloSwift/AppDelegate.swift#L48 for an example
closing due to inactivity + I believe ^ is the correct solution
@Bucimis sorry for the delay, I only just got round to uncommenting out the code you mentioned might be the cause.
However, even after doing that, it is still an issue. To summarise, still experiencing the issue of:
With the deep linking, clicking a push DOES open our app, however it does not navigate to the desired page.
Are you able to provide an example of how this journey would look to set up? Specifically, the setting of a deep link in the dashboard (the screenshot section). How does the app actually know how to redirect to the desired page as there is no code I can see which is doing so?
We also have this set to true in our config:
'com.appboy.api_key': XXX,
'com.appboy.firebase_cloud_messaging_registration_enabled': 'true',
'com.appboy.android_handle_push_deep_links_automatically': 'true',
'com.appboy.android_small_notification_icon': 'ic_stat_name',
'com.appboy.android_large_notification_icon': 'ic_stat_name',
'com.appboy.android_notification_accent_color': '#F6443A',
'com.appboy.android_api_endpoint': XXX
'com.appboy.android_fcm_sender_id': XXX,
'com.appboy.android_default_session_timeout': 'str_5',
'com.appboy.android_log_level': '0',
'com.appboy.ios_disable_automatic_push_registration': 'NO',
'com.appboy.ios_enable_idfa_automatic_collection': 'NO',
'com.appboy.ios_api_endpoint': XXX
Hi @KirstenStake, did you also
The calls to Appboy
(e.g. Appboy.sharedInstance()!.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler)
) are where the contents of the push notification get sent to the SDK for further processing. Inside those methods, Braze handles deep links using the iOS open
function (https://developer.apple.com/documentation/uikit/uiapplication/1648685-open)
hi @Bucimis thank you for the guidance. i really appreciate this!
I did not have the above two steps implemented. However, even after implementation, it is still not working. (no direct opens recorded and no deep link navigation triggered)
Have added this function func userNotificationCenter
to AppDelegate.swift
Added code section to func application
, which results in function looking like so:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let center = UNUserNotificationCenter.current()
var options: UNAuthorizationOptions = [.alert, .sound, .badge]
if #available(iOS 12.0, *) {
options = UNAuthorizationOptions(rawValue: options.rawValue | UNAuthorizationOptions.provisional.rawValue)
}
center.requestAuthorization(options: options) { (granted, error) in
Appboy.sharedInstance()?.pushAuthorization(fromUserNotificationCenter: granted)
}
center.delegate = self
center.setNotificationCategories(ABKPushUtils.getAppboyUNNotificationCategorySet())
UIApplication.shared.registerForRemoteNotifications()
// enable pasteboard check
Branch.getInstance().checkPasteboardOnInstall()
// Override point for customization after application launch.
Branch.getInstance().initSession(launchOptions: launchOptions)
return true
}
Push notification opens the app, but no re-directs happen via deep linking and direct opens not logged. (if it helps, same deep link was used for Android and deep. link navigation occurs (except if app is in background, but that's a whole other can of worms)
We are trying to send a push notification which links to a web page when the user clicks the push. However, on iOS this linking is not working.
Upon investigating within the dashboard we realised that for iOS the direct opens are not logging either. Is this related to the above issue?
As a summary, the issues are: