Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show iOS push notifications as alert popup instead of banner style

I'm registering my app for receiving push notifications from APNS in application:didFinishLaunchingWithOptions: method this way:

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

The registration is ok and my provider succesfully gets my token, in fact I do receive push notifications, but when my app is not in foreground a banner is displayed. I expected an alert to be shown, with 'Close' and 'View' buttons, and I receive the "alert" string in the payload dictionary... what could be happening?

like image 841
AppsDev Avatar asked Nov 17 '25 16:11

AppsDev


1 Answers

Check the phone settings, users can customize how they want Push Notifications to appear on their devices.

  1. Go to 'Settings' app on your iOS device.
  2. Then choose 'Notifications'
  3. Tap on your app's name which is displayed in the list
  4. Change display settings for push notifications (screen shot below)

iPhone push settings

You can not change this setting using code (Reference: https://stackoverflow.com/a/9137501/)

However, you may check the current setting and then request the user to change it.

like image 160
Aziz Shaikh Avatar answered Nov 20 '25 06:11

Aziz Shaikh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!