Capacitor: Add requestPermissions() for push notifications / Local Notifications

Created on 3 Oct 2018  路  2Comments  路  Source: ionic-team/capacitor

I'd like to be able to check if the user has granted permission for notifications. This way we tell them to change it in their settings, etc.

Proposed methods
LocalNotifications.checkPermissions()
or
App.checkPermissions() (returns object of entire app permissions)

Most helpful comment

I went with LocalNotifications.areEnabled(), as it's not really a permission and the name is closer to the native one.

const areEnabled = await LocalNotifications.areEnabled();
console.log('are notifications enabled?', areEnabled.value);

All 2 comments

I went with LocalNotifications.areEnabled(), as it's not really a permission and the name is closer to the native one.

const areEnabled = await LocalNotifications.areEnabled();
console.log('are notifications enabled?', areEnabled.value);

This method can be used to check if push notifications are enabled too. It would be really great if this fact is mentioned on https://capacitor.ionicframework.com/docs/apis/push-notifications because I've spend an hour to find a way to check push notifications permission.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MatanYadaev picture MatanYadaev  路  3Comments

TayKara picture TayKara  路  3Comments

ebk46 picture ebk46  路  3Comments

json-derulo picture json-derulo  路  3Comments

mlynch picture mlynch  路  3Comments