-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Closed
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
Description
We have runtime permissions in our application like almost all applications.
When user denies permission, need to explain "Why we need this permission" in rationale dialog. Title and Message can add but positive and negative buttons can not add for Android AlertDialog. Actually, it is not using AlertDialog for android platform.
From react-native documentation for PermissionsAndroid
https://facebook.github.io/react-native/docs/permissionsandroid.html
there are mentioned about Title and Message but nothing about Positive & Negative buttons.
Reproduction Steps and Sample Code
Example Code
import { PermissionsAndroid } from 'react-native';
export const RequestAndroidPermission = (permission,rationale) => {
return new Promise((resolve, reject) => {
PermissionsAndroid.check(permission)
.then(grantedPreviously => {
if (grantedPreviously) {
resolve()
} else {
PermissionsAndroid.request(permission, rationale)
.then(granted => {
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
resolve()
} else {
reject()
}
}).catch( e => reject(e))
}
}).catch(e => reject(e))
})
}
const locationPermissionType = PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION
const locationPermissionRationale = {
title: "Location Access",
message: 'Need for detect your location to select location nearby you easily'
// how to create Positive and Negative alert dialog button here ?
}
export const RequestAndroidLocationPermission = () => RequestAndroidPermission(locationPermissionType,locationPermissionRationale)
Solution
I tried to follow the code flow, it is passing over android Dialog but I could not see the code which is called from.
Additional Information
- React Native version: 0.43.4
- Platform: Android ( iOS did not check yet )
- Development Operating System: Not important for this issue
- Dev tools: Not important for this issue.
tiaanduplessis, MarkOSullivan94 and ashokkumar88
Metadata
Metadata
Assignees
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.