I have an application that uses a webview and inside the webview is a map, I have got it working to the user automatically find the users location with the following code:
That's because you need to create the prompt. The onGeolocationPermissionsShowPrompt
function is simply called to let you know the webpage wants the location.
callback.invoke(origin, true, false);
is the response telling the WebView it's OK to use the location.
The last argument is whether or not to remember this setting. See: http://developer.android.com/reference/android/webkit/GeolocationPermissions.Callback.html
Example:
AlertDialog.Builder adb = new AlertDialog.Builder(context);
..... //set up title, message, etc
adb.setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
callback.invoke(origin, false, false);
}
});
adb.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
callback.invoke(origin, true, false);
}
});
adb.show();