Cordoba geolocation accuracy is limited to 10 meters

Update: This is the issue of the Google Play service reported here and it will be fixed from version 13.4.0.

We use the cordova gelocation plugin and the navigator.geolocation.watchPosition() method with the enableHighAccuracy: true option to track the user's location and get the most accurate results.

Our application has existed for more than 1 year, and we did not have problems with any device receiving very good location accuracy, 4/6 meters on the street and in a clear sky.

Recently, many of our users have reported that they cannot get an accuracy of less than 10 meters no matter what they do.

We decided to test it ourselves, and we found that the same problem. Initially, we thought that in our latest release some errors were detected, we all checked three times, but did not make any changes to the code / dependencies related to geolocation.

We also tested older versions of our application, where we are sure that you can get accuracy up to 4 m, but, surprisingly, they also do not work, the accuracy is limited to 10 m.

We tried different versions of Android and can reproduce the problem on any platform from 5 (Lollipop) to 8 (Oreo). We also have the same issue on iOS 10/11. Again, we have not been updating the application for months.

There is a recent question about the same issue here :

Someone has the same issue using native Android code here

Does anyone know what is going on? Is this a resolution issue? Location services are also tuned for high accuracy.

For completeness, we can get an accuracy of 3/4 meters using the old version (2.x) of this plugin.

Is this the only way?

We would prefer not to introduce an additional dependency for something that worked so well out of the box.

Thank you very much

+18
source share
2 answers

For whom this may concern, this is a Google Play Services issue reported here and it will be fixed from version 13.4.0

Update: resolved after upgrading to Play Services 14.3.66, accuracy again to 4 m!

+1
source

Looking at the source code:

Old plugin (2.x) Source :

  watchPosition: function(success, error, args) { var win = function() { var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation'); geo.watchPosition(success, error, { enableHighAccuracy: args[1] }); }; exec(win, error, "Geolocation", "getPermission", []); }, 

New plugin (master) Source :

 watchPosition: function(success, error, args) { var pluginWatchId = utils.createUUID(); var win = function() { var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation'); pluginToNativeWatchMap[pluginWatchId] = geo.watchPosition(success, error, args); }; var fail = function() { if (error) { error(new PositionError(PositionError.PERMISSION_DENIED, 'Illegal Access')); } }; exec(win, fail, "Geolocation", "getPermission", []); return pluginWatchId; }, 

In the OLD code of the plugin, enableHighAccuracy is a boolean value (arg1 array).

With the new version of the plugin, you need to pass arg as JSON with the specified flag: {enableHighAccuracy: true} to play the same call to the geo.watchPosition function with high precision.

Old way:

 navigator.geolocation.watchPosition(geolocationSuccess, geolocationError, [false,true]); 

New way:

 navigator.geolocation.watchPosition(geolocationSuccess, geolocationError, { enableHighAccuracy: true }); 
+4
source

Source: https://habr.com/ru/post/1275524/


All Articles