In my app I want to enable/disable push notification from the settings page of my app itself.Can any one suggest me a solution to turn on/off the status of app in notification center from the app ?
you can register and unregister the remote notification with bellow code.
Register RemoteNotification with bellow code..means Enable notification
//-- Set Notification
if ([[UIApplication sharedApplication]respondsToSelector:@selector(isRegisteredForRemoteNotifications)])
{
// For iOS 8 and above
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
// For iOS < 8
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
and Disable it with bellow code.
[[UIApplication sharedApplication] unregisterForRemoteNotifications];