Set default iOS local notification style for application

前端 未结 6 425
囚心锁ツ
囚心锁ツ 2020-11-28 09:25

Starting with iOS 5, there are two notification styles: banner and alert (the \"old\" style). A user can set which style to use for each application in the settings. However

相关标签:
6条回答
  • 2020-11-28 09:43

    You probably won't find 'authoritative' from your peers here, you should better ask directly to Apple; and the question has already been asked several times on theirs forums and not answered...

    The HIG programming guide - http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/MobileHIG/TechnologyUsage/TechnologyUsage.html#//apple_ref/doc/uid/TP40006556-CH18-SW1 -

    "iOS apps that support local or push notifications can participate in Notification Center in various ways, depending on the user’s preferences."

    That last sentence is the only 'authoritative hint' i found.

    The USER'S preferences <= you can't force the user ('s preferences). Period. This design choice is clearly the Apple Way (applications' playground IS limited, to ensure the best user experience possible)

    As for more authority... maybe shouting ?

    NO YOU CAN'T CHOOSE YOUR NOTIFICATIONS DISPLAY STYLE, IT'S THE USER'S CHOICE

    Just kidding... Anyway, a workaround might be to provide a way in your application - hint/ tutorial - to push the user to change the alert style himself...

    good luck !

    0 讨论(0)
  • 2020-11-28 09:52

    I would like to add something, since I've opened a TSI and somehow I asked about this and have been answered. From Quinn "The Eskimo!":

    "This depends on you mean. You have some control over how the notification appears based on how you set the UILocalNotification properties (things like alertBody, soundName, and so on). However, if you're asking about the way in which those properties are interpreted (the things the user can customise in Settings > Notifications), those are user preferences and not exposed via any API."

    0 讨论(0)
  • 2020-11-28 09:56

    I have an alarm app for which I also need this functionality. Under iOS5 if the user is using another app when it goes off then the banner appears. Consequently I spent a lot of time browsing for a solution.

    However, it's not possible to control the style of alert generated by a UILocalNotification I'm afraid :(

    You can see from the class reference that there's no provision for it:

    http://developer.apple.com/library/IOs/#documentation/iPhone/Reference/UILocalNotification_Class/Reference/Reference.html

    Or in the plist:

    http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html

    Best thing to do is tell the user what to do to change the settings.

    0 讨论(0)
  • 2020-11-28 09:58

    You can use this line to query the current settings for notification style:

    UIRemoteNotificationType* enabledTypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
    

    You can check the enabledTypes and then instruct the user to change the notification style in the settings.

    0 讨论(0)
  • 2020-11-28 09:58

    have you tried

    [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
    

    in your didFinishLaunching method, this won't help those updating but should enable alerts for those first installing

    0 讨论(0)
  • 2020-11-28 10:00

    Obviously you don't like hearing no for an answer, but, no.

    0 讨论(0)
提交回复
热议问题