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:

                    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..


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).

I have seen you issue on github. I'm using ng-cordova plugin. I use the below workaround to get GPS-only working. As low-accuracy is faster, the timeout is 4s.

$cordovaGeolocation.getCurrentPosition({enableHighAccuracy: false, maximumAge: MAXAGE, timeout: 4000})
                function (position) { //success Low-Accuracy
                    console.log('getCurrentPosition: HighAccuracy false: Ok!');
                function(err) { //error Low-Accuracy
                    $cordovaGeolocation.getCurrentPosition({enableHighAccuracy: true, maximumAge: MAXAGE, timeout: 10000})
                        function (position) { //success High-Accuracy
                            console.log('getCurrentPosition: HighAccuracy true: Ok!');
                        function(err) { //error High-Accuracy
                            console.log('getLocation: ERRO: ' + ERROR[err.code] + ' => ' + err.message);


I've been struggling with the same issue for the whole day and i've found out that cordova geolocation plugin for android uses geolocation capability of the WebView, don't know why, but for WebView 'gps only' is not enough.

So, i've started to search for some alternatives and found

Plugin is quite awesome but requires android play services. I've written small angular service for geolocation:

 multiplatformGeolocation.inject = ['$q'];
    function multiplatformGeolocation ($q) {
        var self = this;

        this.getCurrentPosition = function (opts) {
            var q = $q.defer();

            self.locationModule.getCurrentPosition(function (result) {
            }, function (err) {
            }, opts || self.positionOptions);

            return q.promise;

        this.init = function () {
            self.positionOptions = {
                timeout: 20000,
                enableHighAccuracy: false,
                priority: PRIORITY_BALANCED_POWER_ACCURACY

            self.locationModule = window.cordova && window.cordova.platformId == 'android' ? LocationServices : navigator.geolocation;

Note that I've used PRIORITY_BALANCED_POWER_ACCURACY, it lets the device use the network to find current position if gps is disabled.


 ? cordova-plugin-media callback methods
 ? Can you use cookies in a Cordova application?
 ? Badge on app icon for Android doesn't show even after implementing ngCordova (cordova-plugin-badge) and phonegap-plugin-push
 ? Call a native android app from ionic app
 ? How to use ngcordova facebook and push notification plugins in single ionic app
 ? SQLite plugin for Cordova: Code running backwards
 ? Refreshing the battery status with AngularJS/Ionic
 ? ionic not rendering google maps on first load
 ? Grunt file not loading ngCordova and jquery
 ? Animated directional arrows "aroundMe" style using ngCordova