Skip to content

On Android API 31, PermissionsAndroid.request(POST_NOTIFICATIONS) always returns never_ask_again #36212

@Bilal-Abdeen

Description

@Bilal-Abdeen

Description

To support the new notifications permission requirements for Android API 33, I added the following call to my code.
PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS).

On an Android API 33 emulator, it works perfectly fine - the user is asked to grant permission, and the returned result is correct.

However, on an Android API 31 emulator, it always returns PermissionsAndroid.RESULTS.NEVER_ASK_AGAIN. I expected it to return PermissionsAndroid.RESULTS.GRANTED.

By the way, on an Android API 31 emulator, there are NO problems with the other permissions, e.g. PERMISSIONS.READ_CONTACTS. The user is asked, and it returns the user's selection correctly.

Version

0.71.2

Output of npx react-native info

npm WARN config global --global, --local are deprecated. Use --location=global instead.
info Fetching system and libraries information...
System:
OS: Windows 10 10.0.19042
CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Memory: 11.20 GB / 31.90 GB
Binaries:
Node: 16.15.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 9.4.1 - C:\Program Files\nodejs\npm.CMD
Watchman: 20220614.153706.0 - C:\ProgramData\chocolatey\bin\watchman.EXE
SDKs:
Android SDK: Not Found
Windows SDK:
AllowAllTrustedApps: Disabled
Versions: 10.0.17763.0, 10.0.19041.0
IDEs:
Android Studio: AI-212.5712.43.2112.8512546
Visual Studio: Not Found
Languages:
Java: 11.0.15 - C:\Program Files\Common Files\Oracle\Java\javapath\javac.EXE
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.2 => 0.71.2
react-native-windows: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS);

Snack, code example, screenshot, or link to a repository

const checkResult = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS);
console.log("checkResult:", checkResult);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions