breautek commented on issue #294: URL: https://github.com/apache/cordova-plugin-geolocation/issues/294#issuecomment-3954265929
The [webview geolocation](https://developer.android.com/reference/android/webkit/WebSettings#setGeolocationEnabled(boolean)) is enabled by default, it doesn't need to be enabled explicitly. But to use it, the geolocation permission hook needs to be implemented which is done via https://github.com/apache/cordova-android/blame/master/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java#L167C17-L167C30 It delegates to the geolocation plugin, if available. Additionally, permissions needs to be declared in the manifest, which is handled by the plugin via https://github.com/apache/cordova-plugin-geolocation/blob/882fbcc008ea86a9f88fe1a9791c0e4e91adf52a/plugin.xml#L44-L45 > Did you try it yourself? I did, and I don't reproduce your issue, running on Webview 145.0.7632.79. I used both `getCurrentPosition` API and the watch API with airplane mode enabled. I also had `enableHighAccuracy` enabled. I also tested with `enableHighAccuracy` enabled and disabled. With `enableHighAccuracy` disabled, events comes in slower but it still works. In high accuracy mode, events comes in at approximately one event per second which is the expected frequency. Then I tested with `timeout` declared and saw no difference in behaviour. I still get GPS reported. Then I tested with `maximumAge` declared, and saw no difference in behaviour. Tested on current stable of cordova-android & geolocation plugin with the hello cordova template. > but something has changed (permissions or configuration) such that my Cordova app no longer gets a response when in Airplane Mode. I can say confidently that geolocation hasn't changed recently and if there are breaking changes to the API, it's certainly isn't documented. This is a bit of a tangent but I'll share some of my experience... And in my experience (as someone who heavily works with GIS systems for the last 10 years) - GPS-only data on most devices is incredibly unreliable. Phones very much rely on A-GPS features, and even then they don't always work with no clear explanation why. In my applications, GPS is used to record a driven path, used to associate data. There are times where the recorded log has garbage data, with high accuracy readings (meaning the collected GPS points are very inaccurate and doesn't represent their true location). They can then repeat their log and the GPS would be fine. I don't typically see cases where there are no location points, unless if the user has A-GPS features disabled, which usually always indicates a poor satellite fix and that generally resolves itself after ~15 minutes. Even then, reported GPS is usually not as accurate as GPS + A-GPS. Not saying these issues happen often -- but they do happen from time to time. Currently my apps uses the geolocation plugin as-is, and thus relying on the webview implementation, but I've also used the native APIs directly in the past and there is virtually no difference in stability in my own experience, just the native APIs do give you more flexibility in configuration. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
