Looking at the generated code, WebViewForeign.java
, geolocation isn’t enabled in the webview. This stops you being able to run a location query in the browser which is a pain.
public static Object CreateWebView321(final boolean zoomEnabled,final boolean scrollEnabled)
{
ScrollableWebView wv = new ScrollableWebView(com.fuse.Activity.getRootActivity());
wv.getSettings().setJavaScriptEnabled(true);
wv.getSettings().setUseWideViewPort(true); //enabled viewport meta tag
wv.getSettings().setLoadWithOverviewMode(true); //mimic iOS Safari and Android Chrome
wv.getSettings().setSupportZoom(zoomEnabled);
wv.getSettings().setBuiltInZoomControls(zoomEnabled);
wv.getSettings().setDomStorageEnabled(true);
wv.setAllowScroll(scrollEnabled);
return wv;
}
Adding these lines would enable GPS location. They would have no effect unless the ACCESS_LOCATION and ACCESS_FINE_LOCATION permissions were set in the manifest which you can force by loading the FuseJS/Geolocation module.
wv.getSettings().setGeolocationEnabled(true);
wv.setWebChromeClient(new WebChromeClient(){
@Override public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) {
callback.invoke(origin, true, false);
}
});
My mistake, there is a webchromeclient created further up which means the code would need moving a little, I was posting before I tested.
In WebViewForeign.java
add
wv.getSettings().setGeolocationEnabled(true);
and in FuseWebChromeClient.java add
import android.webkit.GeolocationPermissions.Callback;
...
...
@Override public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) {
callback.invoke(origin, true, false);
}