UIKit.UIUserNotificationSettings Class
Permissions for local notifications, as controlled by the application user.

See Also: UIUserNotificationSettings Members

Syntax

[Foundation.Register("UIUserNotificationSettings", true)]
[ObjCRuntime.Availability(Introduced=ObjCRuntime.Platform.iOS_8_0)]
public class UIUserNotificationSettings : Foundation.NSObject, Foundation.INSCopying, Foundation.INSSecureCoding, IDisposable

Remarks

Starting with iOS 8, users must give explicit permission for apps that wish to respond to local notifications.

Prior to attempting to send local notifications, devs must request permission from the application user to manipulate the app icon badge, play a sound, or display an alert (see UIKit.UIUserNotificationType). Typically, this is done in the UIAppDelegate.FinishedLaunching overridden method:

F# Example

UIUserNotificationSettings.GetSettingsForTypes(
    UIUserNotificationType.Alert 
    ||| UIUserNotificationType.Badge 
    ||| UIUserNotificationType.Sound, 
new NSSet())
|> UIApplication.SharedApplication.RegisterUserNotificationSettings          
        

C# Example

var settings = UIUserNotificationSettings.GetSettingsForTypes(
    UIUserNotificationType.Alert 
    | UIUserNotificationType.Badge 
    | UIUserNotificationType.Sound, 
    new NSSet());
UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);          
        

The user is presented with a permissions dialog. Once they have made their choices, the system calls UIAppDelegate.DidRegisterUserNotificationSettings.

The current permissions can be read with UIApplication.CurrentUserNotificationSettings.

Related content

Requirements

Namespace: UIKit
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: 0.0.0.0