I have created methods for grant the permission of location and storage read & write
using the react-native-permission
library. when user is deny the permission then the permission dialog is disabled. But i am trying to do that, the request methods is call in loop until the user allow the permission of location. so, how can i do it. please suggest any solution
Code:
reuestMultiplePermissions = () => {
return new Promise((resolve, reject) => {
requestMultiple([
PERMISSIONS.ANDROID.ACCESS_COARSE_LOCATION,
PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION,
PERMISSIONS.ANDROID.READ_EXTERNAL_STORAGE,
PERMISSIONS.ANDROID.WRITE_EXTERNAL_STORAGE,
])
.then((statuses) => {
if (
statuses[PERMISSIONS.ANDROID.ACCESS_COARSE_LOCATION] ===
RESULTS.GRANTED &&
statuses[PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION] ===
RESULTS.GRANTED
) {
resolve(true);
} else {
reject({});
}
})
.catch((error) => {
reject(error);
});
});
};