In the System Preferences Notifications settings the user can select None, Banners or Alerts for each app. How can I determine the users chosen setting for my app? I've been searching on-line and in the docs without any success so far.
I've looked at How to check Notification alert style for our app? but that's for ios and is more about setting the alert style. I don't want to change the alert style - I just want to know what the user has set it to.
Related
Is there a way to disable the alert settings from an application through code? I am already enabling these settings using below code, but I cant find any method to disable these settings again on user action.
var pushSettings = UIUserNotificationSettings.GetSettingsForTypes(
UIUserNotificationType.Alert |
UIUserNotificationType.Badge |
UIUserNotificationType.Sound,
new NSSet());
UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings);
UIApplication.SharedApplication.RegisterForRemoteNotifications();
There is below method but it doesn't disable the notification in application settings.
UIApplication.SharedApplication.UnregisterForRemoteNotifications
The problem seems to be that iOS prevents registering for push notification with Apple in a manner of time after unregistering. The Apple Docs regarding unregistering say:
You should call this method in rare circumstances only, such as when a
new version of the app removes support for all types of remote
notifications. Users can temporarily prevent apps from receiving
remote notifications through the Notifications section of the Settings
app. Apps unregistered through this method can always re-register.
https://developer.apple.com/documentation/uikit/uiapplication/1623093-unregisterforremotenotifications?preferredLanguage=occ
So, just don't call unregisterForRemoteNotifications as long as you really need to do it (see Apple Doc).
The user has total control on enabling and disabling notifications for your app, if you want to do it in code, I think you could create a popup leads to
setting page. like this questions shows How to turn on and off notifications in iOS?
My Watch app receives push notifications containing location information and I use that info to show a WKInterfaceMap.
However, when I tap on the map in the notification dynamic interface, my app is opened instead of the Maps app.
I found this forum post stating:
There is no url to call at this time. The user tapping on a WKInterfaceMap object is the only way to launch the Maps app from yours.
Does anyone know why this does not work with WKInterfaceMap objects in a notification?
Since notifications are not interactive, it's not possible to trigger any object interaction in a dynamic notification. Tapping anywhere in the notification area will always launch your watch app.
This is briefly mentioned in the App Programming Guide, under Designing Your Dynamic Interface:
Tapping your notification interface launches the app, so notification interfaces should not contain interactive controls.
So I want to know how a quickreply toast can be sent to the right person and when you click on it, it goes to the specific person.
Example 1:
Person A texts me, I pull down on the interactive notification and type my response and it gets processed by the background process. How does the applications know that my response goes to Person A. is there an attribute in the XML of the toast that can be a variable, like the phone number?
Example 2:
Person A posts a picture on my facebook, I click on the notification and it takes me to the page on facebook. Again is there an XML variable with a URL of it or something?
You can download this Microsoft Windows UWP sample, where you can see what code they use to manage notifications.
I think that you need Toast notifications:
Toast notifications are small pop ups that appear on the screen for few seconds. They convey messages and can be customized to even play different sounds. New to Windows 10 are actionable toasts where a user has a choice to interact with the notifications by use of a button, for example.
In my iOS calendar app When Request privacy from EKEventstore For Event all thing done well.But when allow app to access Reminders All calendar disappear and when try to get calendars nil returned.
This issue in iOS 7.1 only.
Steps to produced:
1-Reset all Privacy from settings.
2-Run calendar app.
3-Request Privacy to access Events.
4-get calendar from store work correctly.
5-Request Privacy to Access Reminders.
6-Kill app and reopen it.
6-get calendar doesn't work correctly and return nil.
Anyone can help me ?
Could you please check how many calendars and reminders list you have, if they are more than 100, then the event store will stop working correctly.
For more information check this from apple: iCloud: Limits for Contacts, Calendars, Reminders, and Bookmarks
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?
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.
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.