Mik378 Mik378 - 14 days ago 4
Javascript Question

Timeout about geolocation always reached when position mode is set to "Device only"

I own a Ionic application (Cordova).

I have this JS code aiming to get the position of the Android's device:

$cordovaGeolocation.getCurrentPosition({
enableHighAccuracy: true,
timeout: 15000
})


$cordovaGeolocation
comes from ng-cordova lib.

I successfully checked that the plugin
org.apache.cordova.geolocation
is updated with the last current version.

Some users complain about more 15 seconds for the first query!

Note that the timeout is set to 15000 ms => 15 seconds.

Meaning that the device did not succeed to establish the position.

After investigating, I figured out the issue:

those users had set their position mode to "Device Only" or also called "GPS only" in their device's setting.

When the user switches to "High Accuracy mode", the whole works in less than a second.

How to fix this issue without advising user to switch to "High accuracy mode" ?
Is it a bug?

Note that I also tested with
enableHighAccuracy: false
, but same result.

I'm not the only one having this "big" issue:

Phonegap - Geolocation with PowerSaving and GPS Only Mode

but unanswered..

Answer

I struggle that issue for three days, and there is no solution. It just not working and never been. So I will try use another tool, because cordova just don't fit for geolocation purposes. Now I'm focus on java and I want do this properly (ios was a bonus, when I choose cordova).