Alert Style

Is there any way to set the default alert style for an app? I know the user can set it to Alert, Banner, or None in the settings but I would like to be able to set the default to Alert for the app when it first registers for notifications.

Posts

  • prashantvcprashantvc USXamarin Team Xamurai
    edited September 2016

    Yes, you can default to Alert notification style, when you configure the notifications.

    Here's how you do it (from https://developer.xamarin.com/guides/cross-platform/application_fundamentals/notifications/ios/remote_notifications_in_ios/)

    if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0)) {
        var pushSettings = UIUserNotificationSettings.GetSettingsForTypes (
                           UIUserNotificationType.Alert,
                           new NSSet ());
    
        UIApplication.SharedApplication.RegisterUserNotificationSettings (pushSettings);
        UIApplication.SharedApplication.RegisterForRemoteNotifications ();
    } else {
        UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert;
        UIApplication.SharedApplication.RegisterForRemoteNotificationTypes (notificationTypes);
    }
    
Sign In or Register to comment.