Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Getting iOS Notification Permission Request Answer

$
0
0

I have the following code which seems to be working to ask the user for permission to receive push notifications on the device:

if(UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) {
    UIApplication.SharedApplication.RegisterUserNotificationSettings(UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, new Foundation.NSSet()));
    UIApplication.SharedApplication.RegisterForRemoteNotifications();
} else { UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound); }

This brings up the permissions request correctly on iOS 8 and up. The question I have is how to respond to a user choosing not to allow notifications being sent. Currently when they choose not to allow notifications, all of the registration code still runs and they start receiving notifications anyway.

Wondering if there is some sort of event that would execute when the user hits no.

I am using Azure to send notifications btw.


Viewing all articles
Browse latest Browse all 204402


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>