Agontuk / react-native-geolocation-service

React native geolocation service for iOS and android
https://www.npmjs.com/package/react-native-geolocation-service
MIT License
1.6k stars 290 forks source link

Allow once #359

Open mukuljeswani opened 2 years ago

mukuljeswani commented 2 years ago

I want to get the allow once event from permissions.

const status = await Geolocation.requestAuthorization('whenInUse'); console.log(status) if (status === 'granted') { return true; }

    if (status === 'denied') {
        Alert.alert('Location permission denied');
    }

    if (status === 'disabled') {
        Alert.alert(
            `Turn on Location Services to allow "${appConfig.displayName}" to determine your location.`,
            '',
            [
                { text: 'Go to Settings', onPress: openSetting },
                { text: "Don't Use Location", onPress: () => { } },
            ],
        );
    }

here status has values denied, granted, and never ask again. How do I get the value of allow once as if i select allow once option in the device, status is granted and it is getting stored in state variable and I want to empty the variable if the user selects allow once option.