I have an HTML5/jquery-mobile application for cross-platform support. I have Android with WebView and iOS with UIWebView that points to my site. I require geolocation services and while you can pass the device permission from Android to web-app using WebView ChromeClient.
webView.setWebChromeClient(new WebChromeClient(){
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback){
callback.invoke(origin, true, false);
}
});
There is no such thing in iOS. Every time I use the application I get two permission request dialogs from the iOS app and the web-app. I don't use phonegap/cordova and have no need for them. This problem has stumped me for weeks and everyone else who has this problem uses phonegap/cordova.
navigator.geolocation.getCurrentPosition(function(position){
// geolocation logic
}
Any help would be much appreciated.
You can't avoid that alert in UIWebView AFAIK. You could use iOS location API to get current location and pass it to the webpage. Many ways to do this: