I am trying to access the HTML Geolocation API available in Android WebView (using SDK version 24).
The main problem is that the call to navigator.geolocat
Looks like there are 2 different issues in your case:
getCurrentPosition
never failsgetCurrentPosition
never succeedFirst point could be just because method has infinite timeout
The default value is Infinity, meaning that getCurrentPosition() won't return until the position is available.
Second point could be tricky, there is a param maximumAge which means
The PositionOptions.maximumAge property is a positive long value indicating the maximum age in milliseconds of a possible cached position that is acceptable to return. If set to 0, it means that the device cannot use a cached position and must attempt to retrieve the real current position. If set to Infinity the device must return a cached position regardless of its age.
0
by default means that device won't use cached position and will try to fetch the real one and it could be an issue for long response.
Also you could check this reporst which could mean that this API doesn't work really good on Android: https://github.com/ionic-team/ionic-native/issues/1958 https://issues.apache.org/jira/browse/CB-13241
*Cordova leaves geolocation stuff for browser.