Read the notification flag in the Settings app in the iPhone app

I provide a push notification for my application. How can we read flags for notifications in the Settings app when my app is running. For some reason, I need to know if any notification (warning, sound, icon) is set to ON / OFF.

Please guide.

+5
source share
2 answers

Try calling this method. [[UIApplication sharedApplication] enabledRemoteNotificationTypes]

It will return a UIRemoteNotificationType that you can work with to determine what is available.

UIRemoteNotificationType status = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];

int, NSLog(@"status = ", status);, , . UIRemoteNotificationType.

typedef enum {
   UIRemoteNotificationTypeNone    = 0,
   UIRemoteNotificationTypeBadge   = 1 << 0,
   UIRemoteNotificationTypeSound   = 1 << 1,
   UIRemoteNotificationTypeAlert   = 1 << 2,
   UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3
} UIRemoteNotificationType;

, , , ...

  • , 1
  • , 2
  • , 4
  • Newsstand, 8 ( )

, , //. UIRemoteNotificationType (, ) 7.

. , status == 5. , , , ( 1, 4, 5) .

, status == 6? , , , , , .

IF, -

If (status == 5)
{
    NSLog(@"User has sound alerts disabled");
    [self fireThatSpecialMethod];
}

, , . , , !

+11

, iOS 8 , , :

[[UIApplication sharedApplication] isRegisteredForRemoteNotifications]

, .

[[UIApplication sharedApplication] currentUserNotificationSettings]

UIUserNotificationSettings .

:

isRegisteredForRemoteNotifications

currentUserNotificationSettings

UIUserNotificationSettings

0

All Articles