Reputation: 601
I try to use React-native-geolocation (from react-native-community/react-native-geolocation) in my app, with React Native 0.60.5
.
But, that not work. I try a lot of things, do research on the web, but no result. On the emulator, no problem. But on any device, I've got no result.
Is someone use this package ? Or another for replacement ? Thanks a lot (And sorry for my bad English)
Upvotes: 0
Views: 57
Reputation: 130
I used it this way:
Geolocation.getCurrentPosition(
({coords: {latitude, longitude}}) => {
this.setState({
region: {
latitude: latitude,
longitude: longitude,
latitudeDelta: 0.0143,
longitudeDelta: 0.0134,
},
});
},
error => {
console.log('Error:', error);
},
{
enableHighAccuracy: true,
},
);
And I added this setting in file AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
Upvotes: 1