Closed rpig closed 6 years ago
Hi @zhu353071655
Did you add the geolocation permissions in your AndroidManifest.xml ?
Or you could try to ask for permission using https://facebook.github.io/react-native/docs/permissionsandroid.html
PS.: In emulator/simulator the geolocation feature not always works well.
`
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
const result = await PermissionsAndroid.requestMultiple([
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION,
PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE,
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
PermissionsAndroid.PERMISSIONS.CAMERA,
]);
render() {
return (
<WebViewAndroid
source={{ uri: this.props.url }}
geolocationEnabled={true}
onNavigationStateChange={this.onNavigationStateChange}
style={[styles.container, this.props.style]}/>
);
}`
I do it, but not work
@lucasferreira
Did you try on real device?
How are trying to get the geolocation in your HTML file? How about your HTML?
I want to get location,but it don't work, how can I do