I have just upgraded my app from Expo SDK 37.0.0 to 38.0.0. The app works fine on iOS but on Android I get the following warning and the app doesn't geolocate me on the map.
Development environment :
- Expo SDK 38.0.0 (managed workflow)
- React Native 0.62
- Maps provider : Google Maps on Android
- react-native-maps: 0.27.1
- React: 16.11.0
- Device : Honor 8X/Android 10
Expected result : The app should geolocate me (the user) based on my position. Actual result : The app doesn't geolocate me (the user) based on my position. Warning :
[Unhandled promise rejection: Error: Location provider is unavailable. Make sure that location services are enabled.]
What have I tried so far?
Ran expo upgrade once more to ensure that all of your packages are set to the correct version.
Deleted package-lock.json and node_modules and ran npm install.
Set Location.getCurrentPositionAsync({accuracy:Location.Accuracy.High})
Set Location.getCurrentPositionAsync({ enableHighAccuracy: true })
import * as Location from 'expo-location'; import * as Permissions from 'expo-permissions'; async _getLocationAsync() { let { status } = await Permissions.askAsync(Permissions.LOCATION); if (status !== 'granted') { /* If user hasn't granted permission to geolocate himself herself */ Alert.alert( "User location not detected", "You haven't granted permission to detect your location.", [{ text: 'OK', onPress: () => console.log('OK Pressed') }] ); } let location = await Location.getCurrentPositionAsync({ accuracy: Location.Accuracy.High }); this.setState({ userLat: location.coords.latitude, userLng: location.coords.longitude, navGeoStatus: true, lat: location.coords.latitude, lng: location.coords.longitude }); }```
AndroidManifest.xml
? – Hoarfrost