Closed suprith-lumber closed 2 hours ago
react-native -v
Plugin config
useEffect(() => { if (Platform.OS !== 'web' && locationEnabled) { BackgroundGeolocation.start(); const onLocation: Subscription = BackgroundGeolocation.onLocation( (location) => { console.log('[onLocation] location: ', location); setLongitude(location?.coords.longitude); setLatitude(location?.coords.latitude); }, (error) => { console.log('[onLocation] ERROR: ', error); } ); return () => { onLocation.remove(); }; } }, []); useEffect(() => { const locationPermission = async () => { if (locationEnabled && status !== 'CLOCKED OUT') { BackgroundGeolocation.start(); let location = await BackgroundGeolocation.getCurrentPosition(options); setLatitude(location.coords.latitude); setLongitude(location.coords.longitude); } else { BackgroundGeolocation.stop(); } } locationPermission(); }, [locationEnabled, status]); const onLocation: Subscription = BackgroundGeolocation.onLocation( (location) => { setLongitude(location?.coords.longitude); setLatitude(location?.coords.latitude); }, (error) => { console.log('[onLocation] ERROR: ', error); } );
App should work normally irrespective of location permission is provided or denied
When location permission is denied app freezes and no actions work
Track location co-ordinates, as discussed in issue https://github.com/transistorsoft/react-native-background-geolocation/issues/2193
Can I know what permission the user chooses finally, Don't Allow OR Always Allow OR Allow when using this App. How do I know that?
Plugin version: 14.7.5
This version does not exist.
Duplicate #2202
Plugin version: 14.7.5 This version does not exist.
I mean 4.17.5
Your Environment
react-native -v
): 0.73.6Plugin config
Expected Behavior
App should work normally irrespective of location permission is provided or denied
Actual Behavior
When location permission is denied app freezes and no actions work
Steps to Reproduce
Context
Track location co-ordinates, as discussed in issue https://github.com/transistorsoft/react-native-background-geolocation/issues/2193
Debug logs
Can I know what permission the user chooses finally, Don't Allow OR Always Allow OR Allow when using this App. How do I know that?
Logs
``` LOG [onLocation] {"error": 1} ```