EddyVerbruggen / nativescript-local-notifications

:mailbox: NativeScript plugin to easily schedule local notifications
MIT License
162 stars 57 forks source link

Can't enable by method requestPermission notifications on android. #177

Closed ezlo-anatoliiv closed 4 years ago

ezlo-anatoliiv commented 4 years ago

Can't enable by method requestPermission notifications on android. It is returning always true even the notifications are disabled.

requestPermission() {
    return new Promise((resolve, reject) => {
      try {
          resolve(true)
      } catch (ex) {
        console.log("Error in LocalNotifications.requestPermission: " + ex);
        reject(ex);
      }
    });
  }
EddyVerbruggen commented 4 years ago

I don’t think you can actually request permission if the user disabled them manually. But what we could do is returning the result of “hasPermission” instead. Would that help?

ezlo-anatoliiv commented 4 years ago

You need is checking actual state for status of notifications and return true/false like it method works for iOS. It will be behaviour when user already used notifications and want re-enable again.

Totally we have two behaviours for this function, when user at first is enabling notifications and we call this method and is showing this alert alert1 and it's fine.

And second case when you had have disabled notifications and want re-enable. For this case you need check system settings for status of notifications and the best way should be send the user to settings like this for manual enabling notif-beh

EddyVerbruggen commented 4 years ago

Yes that’s what I proposed, except for the bit where you redirect the user to the settings. Did you find a good way to implement that?

ezlo-anatoliiv commented 4 years ago

Actually no, for now you can check only actual state for settings and return true/false like for iOS. It will fix current bug for this method. Behaviour with redirect it's more right and it can be implemented like next feature

EddyVerbruggen commented 4 years ago

Sure, let me fix that for you later today.

ezlo-anatoliiv commented 4 years ago

Thanks very much

EddyVerbruggen commented 4 years ago

Please update to 4.1.1.

ezlo-anatoliiv commented 4 years ago

Thanks