Notifications allowed

Is there a function that will tell if the user has allow notifications from the app settings on the phone? Is it ```
areEnabled() => Promise

checkPermissions() => Promise<PermissionStatus>

Both Local and Push notifications use the same logic.

How “are enable” relate to it?

Not sure what you mean. checkPermissions checks whether or not the user has allowed notifications.

A correction, the push notification docs says the following:

If you need to check if the user allows to display notifications, use local-notifications plugin.

So you would want to use the method from the Local Notification plugin - Local Notifications Capacitor Plugin API | Capacitor Documentation

Android introduced the notifications permission on Android 13.

areEnabled returns if the notifications are enabled or not.

checkPermissions returns on Android < 13 if the notifications are enabled or not, and on Android 13 and newer if the user allowed the permission or not.

Should I check for both areEnabled and checkPermissions or would areEnabled be enough?

areEnabled is deprecated, checkPermissions should be enough.

on v6 I don’t see it deprecated. You have a source where it is? Local Notifications Capacitor Plugin API | Capacitor Documentation

Might be a bug on how the docs get generated from the types, but the types show it as deprecated

Thank you. We are using Check Permissions. This forum has been very helpful.

1 Like