lucasferreira / react-native-webview-android

Simple React Native Android module to use Android's WebView inside your app
355 stars 158 forks source link

geolocationEnabled don't work #92

Closed rpig closed 6 years ago

rpig commented 6 years ago

I want to get location,but it don't work, how can I do

lucasferreira commented 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.

rpig commented 6 years ago

`

<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

lucasferreira commented 6 years ago

Did you try on real device?

How are trying to get the geolocation in your HTML file? How about your HTML?