getNotificationSettings() returns DENIED instead of NOT_DETERMINED on fresh app install (Android 13+)
Bug Description
On Android 13+ devices, notifee.getNotificationSettings() incorrectly returns AuthorizationStatus.DENIED (value: 0) for fresh app installations. This prevents apps from requesting notification permissions on first launch, even though the permission should be requestable at runtime.
Expected Behavior
On a fresh app install, getNotificationSettings() should return AuthorizationStatus.NOT_DETERMINED (-1), allowing the app to request permissions via requestPermission().
Actual Behavior
- Fresh install returns:
AuthorizationStatus.DENIED (0)
- App cannot request notification permissions
- Users never see the permission dialog
Environment
- notifee version:
9.1.8
- React Native version:
0.76.9
- Android target SDK:
35 (Android 15)
- Test device: Android 13+ devices
- Platform: Android only (iOS works correctly)
Code Sample
import notifee, {AuthorizationStatus} from '@notifee/react-native';
const settings = await notifee.getNotificationSettings();
console.log('Authorization Status:', settings.authorizationStatus);
// Expected: -1 (NOT_DETERMINED) on fresh install
// Actual: 0 (DENIED) on fresh install
Logs Output
{
"authorizationStatus": 0, // Should be -1
"android": {
"alarm": 1
},
"ios": {
"alert": 1,
"badge": 1,
"criticalAlert": 1,
"showPreviews": 1,
"sound": 1,
"carPlay": 1,
"lockScreen": 1,
"announcement": 1,
"notificationCenter": 1,
"inAppNotificationSettings": 1,
"authorizationStatus": 0 // Duplicate DENIED status
}
}
Root Cause Analysis
This appears to be related to Android 13's new runtime permission requirements for POST_NOTIFICATIONS. On Android 13+, notification permissions must be requested at runtime, but notifee seems to incorrectly interpret the initial state as "denied" rather than "not determined."
Note: The POST_NOTIFICATIONS permission does not need to be declared in AndroidManifest.xml as it's handled entirely at runtime on Android 13+.
Impact
- Apps cannot request notification permissions on first launch
- Poor user experience (no notification functionality)
- Affects all React Native apps using notifee on Android 13+
- Forces developers to implement workarounds with native Android permissions
Reproduction Steps
- Create a React Native app targeting Android API 33+
- Install notifee and call
getNotificationSettings() on fresh app install
- Observe
AuthorizationStatus.DENIED instead of NOT_DETERMINED
Additional Context
This issue specifically affects Android 13+ due to the introduction of runtime permissions for POST_NOTIFICATIONS in API level 33. The issue doesn't occur on iOS or Android versions below 13.
The POST_NOTIFICATIONS permission is a runtime-only permission on Android 13+ and should not be declared in the manifest. However, notifee's Android implementation appears to misinterpret the permission state before any user interaction, returning DENIED instead of NOT_DETERMINED for fresh installations.
getNotificationSettings() returns DENIED instead of NOT_DETERMINED on fresh app install (Android 13+)
Bug Description
On Android 13+ devices,
notifee.getNotificationSettings()incorrectly returnsAuthorizationStatus.DENIED(value: 0) for fresh app installations. This prevents apps from requesting notification permissions on first launch, even though the permission should be requestable at runtime.Expected Behavior
On a fresh app install,
getNotificationSettings()should returnAuthorizationStatus.NOT_DETERMINED(-1), allowing the app to request permissions viarequestPermission().Actual Behavior
AuthorizationStatus.DENIED(0)Environment
9.1.80.76.935(Android 15)Code Sample
Logs Output
Root Cause Analysis
This appears to be related to Android 13's new runtime permission requirements for
POST_NOTIFICATIONS. On Android 13+, notification permissions must be requested at runtime, but notifee seems to incorrectly interpret the initial state as "denied" rather than "not determined."Note: The
POST_NOTIFICATIONSpermission does not need to be declared in AndroidManifest.xml as it's handled entirely at runtime on Android 13+.Impact
Reproduction Steps
getNotificationSettings()on fresh app installAuthorizationStatus.DENIEDinstead ofNOT_DETERMINEDAdditional Context
This issue specifically affects Android 13+ due to the introduction of runtime permissions for
POST_NOTIFICATIONSin API level 33. The issue doesn't occur on iOS or Android versions below 13.The
POST_NOTIFICATIONSpermission is a runtime-only permission on Android 13+ and should not be declared in the manifest. However, notifee's Android implementation appears to misinterpret the permission state before any user interaction, returning DENIED instead of NOT_DETERMINED for fresh installations.