react-native-geolocation icon indicating copy to clipboard operation
react-native-geolocation copied to clipboard

Permission request pop-up coming twice if i deny permission

Open vishaal-workhall opened this issue 10 months ago • 2 comments

Ask your Question

When the app requests location permissions on Android, the permission popup appears twice. It seems that the PermissionsAndroid.request function is being triggered multiple times under certain conditions, leading to duplicate permission dialogs. why ?

const granted = await PermissionsAndroid.request( PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, );

  if (granted === PermissionsAndroid.RESULTS.GRANTED) {
    console.log('Location permission granted');
    return true;
  } else if (granted === PermissionsAndroid.RESULTS.DENIED) {
    console.log('Location permission denied');
    return false;
  }

Image

vishaal-workhall avatar Jan 23 '25 08:01 vishaal-workhall

I also faced some issue but after using the react-native-permission library it is working fine as the inbuilt PermissionsAndroid of react native does not works ok all the time. I will recommend you to use below library for all the permission handling in react native. https://www.npmjs.com/package/react-native-permissions

anuragchachan avatar Mar 12 '25 07:03 anuragchachan

I also faced some issue but after using the react-native-permission library it is working fine as the inbuilt PermissionsAndroid of react native does not works ok all the time. I will recommend you to use below library for all the permission handling in react native. https://www.npmjs.com/package/react-native-permissions

Even using the react-native-permission yielding the same double pop up issue for me

vishaal-workhall avatar Mar 12 '25 07:03 vishaal-workhall