Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

detect "Allow Notifications" is on/off for iOS8

I am trying to detect the Local notification settings for the App in iOS 8

for UIUserNotificationSettings, it returns me 7 as I have turned on all Badge, Sound & Alert.

In the setting, I switch off "Allow Notification" , the app still return me 7 for UIUserNotificationSettings (Badge, Sound & Alert on). Is there a way to detect "Allow Notification" on/off?

- (void)application:(UIApplication *)application     didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings{      NSLog(@"---notificationSettings.types %d" , notificationSettings.types );     if(notificationSettings.types!=7){         UIAlertView * alert =[[UIAlertView alloc ] initWithTitle:@"Please turn on Notification"                                                          message:@"Go to Settings > Notifications > App.\n Switch on Sound, Badge & Alert"                                                         delegate:self                                                cancelButtonTitle:@"Ok"                                                otherButtonTitles: nil];         [alert show];     } } 
like image 570
JosephT Avatar asked Aug 04 '14 04:08

JosephT


People also ask

How do I know if notifications are enabled?

Check if the notification appears in your Android notification bar or tray. Check that you have enabled notifications on your phone. Android Settings > Apps (then Manage Apps for some users) > Signal > Check on Show notifications. > Notifications > Enable message notifications.

What is allow notifications on my Iphone?

If you turn on Allow Notifications, choose when you want the notifications delivered—immediately or in the scheduled notifications summary—and turn Time Sensitive Notifications on or off. For many apps, you can also set a notification banner style and turn sounds and badges on or off.

Where is tap allow notification shown Iphone?

To see and hear these notifications again, swipe left on the notification in Notification Center, tap Options, then tap Unmute. Turn off notifications for an app or notification group: Swipe left on a notification or group of notifications, tap Options, then tap Turn Off.


1 Answers

Method enabledRemoteNotificationTypes is deprecated since iOS8.

To check remote notifications status in iOS8 you can call

[[UIApplication sharedApplication] isRegisteredForRemoteNotifications]; 

it will return NO if user disable notifications in Settings. Documentation on isRegisteredForRemoteNotifications

Or you can retrieve all current notification settings:

[[UIApplication sharedApplication] currentUserNotificationSettings]; 

Documentation on currentUserNotificationSettings

like image 75
Ponf Avatar answered Sep 18 '22 21:09

Ponf