3

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?

Aziz Shaikh
  • 16,245
  • 11
  • 62
  • 79
AppsDev
  • 12,319
  • 23
  • 93
  • 186
  • My problem is the opposite. I'm sending APNS messages, but they come up as alerts. I don't want to distract the user. I want banners instead, plus the notifications to be listed in the Notification Center / notification drawer – Csaba Toth Oct 22 '15 at 23:45

2 Answers2

7

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.

Community
  • 1
  • 1
Aziz Shaikh
  • 16,245
  • 11
  • 62
  • 79
  • Good answer, thanks, but not sure the last bit is correct..! iOS [refers to banners AND alerts as `UIRemoteNotificationTypeAlert`](https://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/c/tdef/UIRemoteNotificationType), so there's no way of checking which the user has opted for – Shai Jan 28 '14 at 21:19
  • @Shai You maybe correct here, I have based my opinion on the [answer](http://stackoverflow.com/a/17389395/) referenced in my post. – Aziz Shaikh Jan 29 '14 at 05:49
  • Ohh you saved me big time. – Helen Araya May 07 '15 at 15:35
0

Go to Settings->Notifications->select Your App->Alert style(None,Banners,Alert) select Alerts.

Balu
  • 8,470
  • 2
  • 24
  • 41