.accuracy of the GetCurrentGeolocation() function does not update properly

Testing my code i noticed that the geolocation accuracy does not correctly update. Note that geolocation longitude and latitude correctly works fine: when i call my function they are correctly updated.
Moreover , using the site from mobile, I noticed that if I leave my site, then open the Google Maps App and then back to my site, the accuracy of the geolocation is updated. I t seems strange…

Here my code:

var currentShopLat, currentShopLong, currentAccuracy

export function getAndVerifyCurrentGeolocation  () {

    currentShopLat, currentShopLong, currentAccuracy = ""
    console.log("Starting accuracy: " + currentAccuracy)

    $w("#geolocationStatusText").text = "Localizzazione in corso. Attendi alcuni istanti..."
    setTimeout( function() {
        .then( (obj) => {
            currentShopLat = obj.coords.latitude;       console.log("currentShopLat: " + currentShopLat)      // 32.0971036
            currentShopLong = obj.coords.longitude;     console.log("currentShopLong: " + currentShopLong)          // 34.774391099999995
            currentAccuracy = obj.coords.accuracy;      console.log("accuracy: " + currentAccuracy)     // 29

            $w("#infoGeolocationText").text = "Lat: " + currentShopLat + " - " + "Lon: " + currentShopLong + " - " + "(Precisione: " + currentAccuracy + ")"

 if (currentAccuracy > 20) {
                console.log("Bad accuracy")
 if (currentAccuracy <= 20) {
                console.log("GOOD accuracy")

 var currentGeolocation = "http://www.google.com/maps/place/" + currentShopLat + "," + currentShopLong;  //imposto il link sul tasto "vedi posizione sulla mappa"
            $w("#goToLocationButton").link = currentGeolocation;
            $w("#goToLocationButton").target = "_blank";

        } )
        .catch( (error) => {
             let errorMsg = error;

        $w("#geolocationErrorText").text = ""
    }, 4000);       

Any suggestions? Thanks in advance!

@yisrael-wix sorry for the mention, but i’m still having this issue and can’t find a solution.

Thanks in advance.

This is really a browser/device issue and not a Corvid issue. If you are calling the function properly, there’s not much Wix can do about it.

Why are you wrapping it in a timeout? It seems like you’re handling the returned Promise correctly.

1 Like

Thank you so much for your answer. Speaking of the timeout, that was old code that I no longer use now.

The new code is this:

export async function checkGeolocation() {
 //function to check/update the user's geolocation in local sotrage

 let functionResults;
 let userLatitude = "";
 let userLongitude = "";
 let userGeolocationAccuracy = "";

 await wixWindow.getCurrentGeolocation()
        .then(async(res) => {
            console.log('res: ', res);
            userLongitude = res.coords.longitude;
            userLatitude = res.coords.latitude;
 if (userLongitude !== '' && userLatitude !== '') { //no errors case
                userGeolocationAccuracy = res.coords.accuracy;
                console.log('lat: ', userLatitude, 'lon: ', userLongitude, 'acc: ', userGeolocationAccuracy);
                functionResults = 'ok';
            } else { //error case
                functionResults = 'error';
        .catch((error) => {
            functionResults = 'error';

 return functionResults;

This new code seems to work fine with the “getCurrentGeolocation ()” function the first time I call it. But, if after a few seconds I call it again, the function returns the exact same results as the first call (even if the position has changed).

So, are you sure that there is no limitation in the Wix “getCurrentGeolocation ()” function? If so, it could actually be a browser issue.
Have you ever encountered a similar issue before?

Thanks for your time.

I did see this at one time. The thing with geoLocation is that it is browser and device dependent. I use this myself on a site for mobile use and I see that it doesn’t always give me what I want. I think that sometimes security and privacy issues between the browser and the device cause the problem.

It’s interesting what you stated in your original post… " using the site from mobile, I noticed that if I leave my site, then open the Google Maps App and then back to my site, the accuracy of the geolocation is updated. I t seems strange… ".

I think I’ll pass this on to QA and ask them if they’re aware of any issues regarding updating of the location.

Does the problem occur on different devices? Browsers?

At the moment I did some tests on Chrome using both ios and android smartphones.

Based on the tests I have done in the last few weeks, it seems that the GoogleMaps app interacts more deeply with the os (and therefore with the integrated GPS ).

So I believe the issue may be one of the following:

  • the interaction between the Chrome app and the os.
  • the interaction between Wix and the Chrome browser api.
  • Restrictions applied by the Wix development team.

Hi @yisrael-wix did you get any responses from QA regarding this problem?
Thank you