我已经创建了使用该库授予位置和存储权限的方法。 当用户拒绝权限时,权限对话框被禁用。但我正在尝试这样做,请求方法是循环调用的,直到用户允许location的权限。所以,我该怎么做。请提出任何解决方案read & write
react-native-permission
代码:
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);
});
});
};