Ole Henrik Oftedal
Posts: 0
Joined: Thu Apr 19, 2012 4:52 pm

Geolocation bug? - both onsuccess and onfail events are executed

Please verify 100% that you have the latest version of Firefox. You can check version by hitting the hamburgermenu and then clicking on "?" and then About Firefox.

I have seen the "Geolocation" bug app work fine on an older Firefox version. But if you remove and reinstall Firefox you will get the bug as descibed.

Latest version is 48.0.2

Ole Henrik Oftedal
Posts: 0
Joined: Thu Apr 19, 2012 4:52 pm

Geolocation bug? - both onsuccess and onfail events are executed

Why are you not helping me?
Yesterday I had two almost identical Windows 10 computers. One computer worked and no errors from Firefox. We call it Computer A. Then the other computer (Lets call it computer B) gave error every second time when using Apperys geolocation service.

Computer A had version Firefox 46.0.1
Computer B had version Firefox 48.0.2

I upgraded to latest version so I had version 48.0.2 on both computers.

Now none of the computers are working as expected.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Geolocation bug? - both onsuccess and onfail events are executed

Appery.io bundles the standard Apache Cordova library which includes the Geolocation API. There is no special Appery.io Geolocation - there is just the Cordova API (the Geolocation service we have inside the App Builder is a wrapper for the API).

The fact that the Geolocation works OK on some devices means that it has to do most likely the how other browsers (Firefox) handle Geolocation lookups.

Desktop browsers will try to use the IP address to determine the location. That could be one reason why a lookup might fail. It's also difficult to say why both success and error callbacks are fired.

It's best to test Geolocation on the actual device as you will get a lot more accurate results.

I recommend you try using the Cordova API directly to test how it works: https://cordova.apache.org/docs/en/la...

Hope this helps.

Ole Henrik Oftedal
Posts: 0
Joined: Thu Apr 19, 2012 4:52 pm

Geolocation bug? - both onsuccess and onfail events are executed

Thanks Max :-)

I will instead try to use the Geolocation api directly.
This (see underneath) I have tested and works fine on Firefox newest versions.

You think this will be better to use this then Appery component/service?

It looks like it aborts the timer when onsucces is called (so not both onerror an onsuccess are executed).

function geolocFail()
{
alert('Geolocation failed');
};

if (navigator.geolocation) {
var location_timeout = setTimeout("geolocFail()", 10000);

Code: Select all

 navigator.geolocation.getCurrentPosition(function(position) { 
     clearTimeout(location_timeout); 

     var lat = position.coords.latitude; 
     var lng = position.coords.longitude; 

     alert(lat); 
 }, function(error) { 
     clearTimeout(location_timeout); 
     geolocFail(); 
 }); 

} else {
// Fallback for no geolocation
geolocFail();
}

(I think I found this somewhere on the stackoverflow site.)

Ole.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Geolocation bug? - both onsuccess and onfail events are executed

The wrapper inside the App Builder and Geolocation API are the same thing. If directly using the API works but the wrapper doesn't work somewhere, then it's something we need to look at. My guess is that Geolocation doesn't work as expected due to the browser.

Return to “Issues”