Notification Center Definition

My application must be configured in the iOS 5 Notification Center as “alerts” and “sounds”. From what I found, your application cannot offer the correct settings, which would be the best option, so correct me if I am wrong.

So, I am looking for a procedure to detect the current settings and alert the user if they are incorrect.

+6
source share
4 answers

This cannot be done programmatically. And "registerForRemoteNotificationTypes" is for push notifications, not local ones.

The only thing I could do was to include in the description of my application in the application store an explanation of how to set up the Notification Center. I also posted this in my demo video.

You might also consider entering a prompt the first time you launch the application, explaining the “correct” notification settings for your application. Do not show it on subsequent launches, but provide it in the Help section.

Of course, “what's right” is what the user wants, but for my application, users NEVER need the default settings, which are “banners”. The best user interface for my application is just sounds. The biggest complaint about my application in front of the Notification Center is the pop-ups from local notifications. Now, with the Notification Center, users can turn off everything except "sounds." This is the setting they all want. Why can't I, as a developer, just give them to them by default? If they want to change it to something else, that's great, but I have to control the default settings. But I ranted.

0
source

in fact, this can be done using the following method -

Types UIRemoteNotificationType = [UIApplicationsharedApplication] .enabledRemoteNotificationTypes;

and types

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

according to: http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIApplication_Class/Reference/Reference.html Therefore, if you want to find out if the user approved your application for notifications, all that what you need to do is check, types >= 4 to know: it won’t tell you if the user was turned on or off the notification center for your application, it will only tell you the TYPE of notification that the user approved

+1
source

I do not think that this can be done programmatically.

You can specify which alerts your application can receive at startup.

I would use this in the application’s application, the didFinishLaunchingWithOptions method

 [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)]; 
0
source

Think of it this way: what would you, as a user, think if all other applications install them? (Of course, you want this to be for your application. But not all applications are as good as yours.) Or, if every other application warned you every time it started?

Impossible, and why.

As Nick said, just put whatever you hope the user turns on. The system will then provide the user with the ability to allow this.

0
source

Source: https://habr.com/ru/post/899364/


All Articles