Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can an app use both alerts and banners in Notification Center?

I am creating a Mac OS X application to use Notification Center. Some notifications should remain on the screen until the user interacts with them, and others should disappear shortly after displaying.

The NSUserNotificationAlertStyle key and changing System Preferences allow changing between banners and alerts. However, both approaches change all the notifications sent from my application.

Can I send some notifications as alerts and others as banners? If so, how?

like image 505
David V Avatar asked Sep 07 '12 14:09

David V


2 Answers

NSUSerNotificationAlertStyle is the only way the developer can set the default notification style for the application, and it sets the style for all notifications from that app.

If you think it's really important for you to have 2 different kinds of notifications you can work around the problem by having a hidden helper application with a different NSUserNotificationAlertStyle than the main app.

Remember though you set the default notification style, but the user can change it whenever he wants in the notification center prefs, making your helper app useless.

like image 61
Franco Solerio Avatar answered Oct 07 '22 10:10

Franco Solerio


No. The different notification types exist so that the user may select what he/she prefers, not so that the developer can.

If you feel your app should have this ability, you should file an enhancement request at http://bugreporter.apple.com and let Apple know.

like image 30
Jonathan Grynspan Avatar answered Oct 07 '22 11:10

Jonathan Grynspan