I added Push notifications to my application. And my application works based on push notifications. When the app runs for the first time, it is showing alert whether user wants to receive push notifications or not. Is it possible to make it mandatory to accept push notifications? Or if this is not possible, can we check whether push notifications are set for this app or not and terminate the application with alert?
Find your notifications in Notification CenterOn the Lock Screen: Swipe up from the middle of the screen. On other screens: Swipe down from the top center. Then you can scroll up to see older notifications, if there are any.
An iOS push notification is a message that pops up on an Apple device such as an iPhone. Before receiving push notifications from an app, iOS device users must explicitly give permission. Once a user opts-in, mobile app publishers can send push notifications to the users' mobile devices.
Setting up Push Notifications in iOS. Go back to the iOS project you created earlier and select the main target. Under the Signing & Capabilities tab, click on the + Capability button, then select Push Notifications. This will enable your app to receive push notifications from OneSignal.
You can only check whether user have selected to receive push-notifications:
UIRemoteNotificationType status = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (status == UIRemoteNotificationTypeNone)
{
NSLog(@"User doesn't want to receive push-notifications");
}
//It's better to use the followiing instead
BOOL status = [[UIApplication sharedApplication] isRegisteredForRemoteNotifications]; if (!status) { NSLog(@"User doesn't want to receive push-notifications"); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With