requestPermission

Request specific notification permissions for your application on the current device.



requestPermission(permissions?: IOSNotificationPermissions): Promise<NotificationSettings>;

Both iOS & Android return an NotificationSettings interface. To check whether overall permission was granted, check the authorizationStatus property in the response:

import notifee, { AuthorizationStatus } from '@notifee/react-native';

const settings = await notifee.requestPermission(...);

if (settings.authorizationStatus === AuthorizationStatus.DENIED) {
  console.log('User denied permissions request');
} else if (settings.authorizationStatus === AuthorizationStatus.AUTHORIZED) {
   console.log('User granted permissions request');
} else if (settings.authorizationStatus === AuthorizationStatus.PROVISIONAL) {
   console.log('User provisionally granted permissions request');
}

For iOS specific settings, use the ios properties to view which specific permissions were authorized.

On Android, authorizationStatus will return only either AuthorizationStatus.DENIED or AuthorizationStatus.AUTHORIZED and all of the properties on the ios interface response return as AUTHORIZED.


PropertyDescriptionOptional
permissions

Copyright 2020 - 2021 © Invertase Limited

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License and code samples are licensed under the Apache 2.0 License.

All product names, logos, and brands are property of their respective owners. All company, product and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.