Reputation: 1095
I tried hablitar the GPS location function for putting this in the manifest android:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
and putting the webview settings this:
setGeolocationEnabled(true);
but still not working. What should I do to make it work? I'm new to this.
Upvotes: 2
Views: 7741
Reputation: 732
You need to begin requesting GPS updates in the code.
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
// Called when a new location is found by the location provider.
}
}
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1000, locationListener);
You can then take the GPS values that you receive and pass them yo the webview through the URL
Upvotes: 2