I have a xamarin forms ios app. When the app is in the foreground, the notification is not displayed, otherwise it is display. However, when the app is in the background and the notification is received tapping the "See More" opens the app and then opens the URL in a browser. I'd like to not open the app and just send the user to the URL. I've tried default as the action type, but that just closes the notification.
FinishedLaunching
`AzurePushNotificationManager.Initialize(
Global.PushNotificationsHubEndpoint,
Global.PushNotificationsHubName,
options,
new NotificationUserCategory[]
{new NotificationUserCategory("link",new List
{ new NotificationUserAction("close","Dismiss",NotificationActionType.Default),
new NotificationUserAction("open","See More",NotificationActionType.Foreground)})}, true);
CrossAzurePushNotification.Current.OnNotificationOpened += (s, p) =>
{
if (!string.IsNullOrEmpty(p.Identifier))
{
if(p.Identifier.ToLower() =="open")
{
foreach (var data in p.Data)
{
if (data.Key == "aps.url" && data.Key.ToString().Length > 0)
{
UIApplication.SharedApplication.OpenUrl(new Uri(data.Value.ToString()));
}
}
}
}
};
...
public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action completionHandler)
{
I have a xamarin forms ios app. When the app is in the foreground, the notification is not displayed, otherwise it is display. However, when the app is in the background and the notification is received tapping the "See More" opens the app and then opens the URL in a browser. I'd like to not open the app and just send the user to the URL. I've tried default as the action type, but that just closes the notification.
FinishedLaunching
`AzurePushNotificationManager.Initialize( Global.PushNotificationsHubEndpoint, Global.PushNotificationsHubName, options, new NotificationUserCategory[] {new NotificationUserCategory("link",new List
{ new NotificationUserAction("close","Dismiss",NotificationActionType.Default),
new NotificationUserAction("open","See More",NotificationActionType.Foreground)})}, true);
CrossAzurePushNotification.Current.OnNotificationOpened += (s, p) => { if (!string.IsNullOrEmpty(p.Identifier)) { if(p.Identifier.ToLower() =="open") { foreach (var data in p.Data) { if (data.Key == "aps.url" && data.Key.ToString().Length > 0) { UIApplication.SharedApplication.OpenUrl(new Uri(data.Value.ToString())); } } }
...
public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action completionHandler)
{
public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken) { try { AzurePushNotificationManager.DidRegisterRemoteNotifications(deviceToken);
`