Push Notification ON or OFF Checking in iOS Push Notification ON or OFF Checking in iOS ios ios

Push Notification ON or OFF Checking in iOS


In iOS 8 you can now use:

[[UIApplication sharedApplication] isRegisteredForRemoteNotifications];

And to check how the settings are setup you could use:

[[UIApplication sharedApplication] currentUserNotificationSettings];


If the App once got registered with the registerForRemoteNotification, then you can disable as well as enable . Once you disable and you are about to Re-Regigister with it, then this will enable the registerForRemoteNotification, without Popup for a alert.

Technical Note TN2265: Troubleshooting Push Notifications

The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day.

If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by setting the system clock forward a day or more, turning the device off completely, then turning the device back on.

Fore More Info: INFO && Info 2

Edit : For checking with alert enable -

use

 if (types & UIRemoteNotificationTypeAlert){} 

instead of

if (types == UIRemoteNotificationTypeNone){}

Edit :Latest update from the doc for iOS 8 or later, You can check out by :

- (BOOL)isRegisteredForRemoteNotifications


It's work for me. Hope this help! :D

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")){    UIUserNotificationType type = [[[UIApplication sharedApplication] currentUserNotificationSettings] types];    if (type == UIUserNotificationTypeNone){        ALERT_WITH_TITLE(@"", kMessageNotificationTurnOnRequire);    }}else {   UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];   if (types == UIRemoteNotificationTypeNone) {       ALERT_WITH_TITLE(@"", kMessageNotificationTurnOnRequire);   }}