user1145643 user1145643 - 1 year ago 85
iOS Question

iOS PUSH notification type options? Alert vs Banner?

I have read through posts on here suggesting that the only way to make PUSH notifications appear as an alert instead of a banner is for the individual end user to change the

Alert Style
in the
section of the app's
. What puzzles me is that there are apps out there that default to
style without having to do this.

Is there a way to programatically set
style through a dialog upon initial launch? I don't mind asking the user to confirm in a dialog. I just know since other apps don't require the user to manually go into settings to change the alert style, there has to be a different method of doing this...

I've got the following -

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
return YES;

Answer Source

Your app only has the rights to check for notification settings, you can never set or change notification types for a user.

When you query notification types the options are as follows

typedef NS_OPTIONS(NSUInteger, UIRemoteNotificationType) {
    UIRemoteNotificationTypeNone    = 0,
    UIRemoteNotificationTypeBadge   = 1 << 0,
    UIRemoteNotificationTypeSound   = 1 << 1,
    UIRemoteNotificationTypeAlert   = 1 << 2,
    UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3,

All you can find out from querying the push settings is wether or not the user has enabled alerts but not how they are displayed (banner vs alert).