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;
}
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.
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.
Android proposes several types of notifications to inform the user: notifications in the system bar. sound notifications. notifications by vibration.
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.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With