Nativescript push notifications - check if enabled



For me this plugin returns always true, no matter what option is select in my Iphone settings regarding this app.

var pushPlugin = require("nativescript-push-notifications");
    pushPlugin.areNotificationsEnabled(function(areEnabled) {
        console.log('ARE ENABLED? ' + areEnabled);

Does this make sense ? What is purpose of this function?
Is there a better way to check if user has disabled / enabled notifications for current app?



As mentioned in the plugin’s read me that’s the purpose. May I ask what you mean by a better way, why you do feel this is not right?


App starts, and then ask for permissions.
You can agree, and the result will be TRUE.

Next, you can go to IOS settings -> apps -> current app -> and uncheck push notifications .Then, when opening app again, the result is still TRUE, but this is not true as IOS has this notifications disabled, and no push notifications will appear, even if this function’s result is TRUE (should be False as this feature is disabled ?)Is this make sense ?

  1. Did you disable all notification types - banner, alert etc., even if one is enabled it will return true.
  2. If still returning true, try restarting the app it could be a issue with bundle cache.
  3. I have been with firebase for long time now, I took a look at plugin code and it seems the method they use to check notification settings is deprecated since iOS 10. May be you can give a try using UNUserNotificationCenter to read settings natively on iOS 10+ devices and see if that solves your issue.