I am building an app (on android and iOS) that wants the device's current location using the ionic framework (cordova, ionic, angular). For that I have been trying to use Cordova's Geolocation Plugin . During my research, I found out that the cordova guys have deprecated the native geolocation implementation because the browser's geolocation was much more efficient HERE . I hoped this was the reason why when I build my app the config.xml file did not contain
<feature name="Geolocation">
<param name="android-package" value="org.apache.cordova.geolocation.GeoBroker" />
</feature>
But on implementing the plugin on my app, the plugin seemed to get the location just fine when my GPS was on but it could not get the location it my GPS was off. Which is completely counter-intuitive to me. What am I missing here? Did I understand wrong when they said they deprecated the android geoloction plugin? I want to know what exactly happens when the geolocation plugin requests for the device's location.
Thanks in advance.
It sounds like the Geolocation is only happening with the GPS and not with WiFi or cellular triangulation.
The plugin has an option for enableHighAccuracy
.
There is an Android bug:
A GPS chip connects directly to satellites. Cellular triangulation makes use of your phone's signal. It is used, for example, in some emergency services to locate you by triangulating how far your phone is from the towers. Here's an interesting Reddit article on a comparison between GPS and cell triangulation. Wifi can also improve location accuracy: see two discussions regarding how Google does this.
There are two damned if you do, damned if you don't issues:
enableHighAccuracy
isn't set to true, the emulator won't return anything; it doesn't matter if you have your GPS on or not. enableHighAccuracy
to true, but this will mean that you must keep the GPS turned on.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.