I\'m currently having an issue with geolocation in a webview. I have a webapp. I\'m currently not using phonegap or any other mobile framework. I\'ve been unsuccessful at ge
Add onGeolocationPermissionsShowPrompt() to MyChromeWebViewClient as below:
private class MyChromeWebViewClient extends WebChromeClient {
@Override
public void onProgressChanged(WebView view, int progress) {
// Activities and WebViews measure progress with different scales.
// The progress meter will automatically disappear when we reach 100%
activity.setProgress(progress * 100);
}
@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
Log.d(LOG_TAG, message);
// This shows the dialog box. This can be commented out for dev
AlertDialog.Builder alertBldr = new AlertDialog.Builder(activity);
alertBldr.setMessage(message);
alertBldr.setTitle("Alert");
alertBldr.show();
result.confirm();
return true;
}
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
callback.invoke(origin, true, false);
}
}
You need to import "android.webkit.GeolocationPermissions".
Add this permission:
This will work I guess.