'React Native Permission rationale not showing

I'm having a trouble with react native permission rationale. It is not showing though I already put it in my code.

const rationale = { title: 'Permission', message: 'message' }
const res = await PermissionsAndroid.request(PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION, rationale);

What is the problem why it's not showing? Thank you for your help.



Solution 1:[1]

Late reply, but perhaps this will help someone else who lands here in the future:

I struggled with this as well recently, until I dug into the documentation on PermissionsAndroid:

If rationale is provided, this function checks with the OS whether it is necessary to show a dialog explaining why the permission is needed (https://developer.android.com/training/permissions/requesting.html#explain) and then shows the system permission dialog.

While not immediately clear from that line alone, following the provided link to Google's Documentation yielded this valuable snippet:

If the ContextCompat.checkSelfPermission() method returns PERMISSION_DENIED, call shouldShowRequestPermissionRationale(). If this method returns true, show an educational UI to the user. In this UI, describe why the feature, which the user wants to enable, needs a particular permission.

Essentially, you won't see the rationale on the initial request; it will only be presented after the user has expressly denied the permission (either via the system dialog or through settings). Hope it helps!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Joe