Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 Notifications section of the app's Settings. What puzzles me is that there are apps out there that default to Alerts style without having to do this.

Is there a way to programatically set Alerts 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;
}
like image 755
user1145643 Avatar asked Oct 04 '13 16:10

user1145643


People also ask

What is the difference between banners and alerts on iPhone?

Banners are the pop-up notifications you see while you're using your phone. Below those options are two more: Sounds and Badges. Sounds are the audio tone alerts. Badges are the red circles with numbers that show up on app icons, for example, the one on your email app showing how many unread messages you have.

What is the difference between a push notification and an alert?

Alerts are enabled by the user and are triggered by driving events like speeding, harsh braking, and entering/exiting a geofence. Notifications are set up by the user and are triggered by specified alerts to send an email, SMS text, or a push notification via the mobile app.

What are the 3 types of notifications?

Android proposes several types of notifications to inform the user: notifications in the system bar. sound notifications. notifications by vibration.

What are the different types of notifications on iPhone?

The Alerts section shows three alert types—Lock Screen, Notification Center, and Banners—followed by an option to enable Sounds and Badges for an app.


1 Answers

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).

like image 50
Jason Grandelli Avatar answered Oct 13 '22 00:10

Jason Grandelli