You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 15, 2021. It is now read-only.
What is the best way today to use geolocation on Android with ngCordova?
Indeed, it seems that, when the plugin is installed, Android always try to use the native way, that..isn't available any more.
Should I write an ugly pseudo-code like: if(window.cordova && isAndroid()) { useTheBrowserImplementation()} elseif(window.cordova && isIos()) {useNgCordova())} ?
No Javascript alert is displayed at all, meaning that ngCordova doesn't return a promise in this case...
Actually, when I don't set the "Position" option (to get the local position of the phone user) on the Samsung parameter section, I don't get any data..and no errors is displayed...
I expected some errors to appear, involved by the promise.
=> can't use the app if "Position" is not set.
@mica16 Any updates on this? Unfortunately I can't test on Samsung Galaxy S4 but I tested it on Samsung Galaxy S3, Samsung Galaxy S5 and Galaxy Tab 4 and it works for all. The problem I have with Android 4.4 in general is that WiFi is not able to find the location. On my Samsung Galaxy S3 the WiFi geolocation works fine.
Actually, I noticed that when the property enableHighAccuracy is set to true, the phone has to enabled GeoPosition, otherwise the Geolocation by the browser is not used, explaining my post above.
I found it very frustrating for certain lambda users that aren't aware about their phone settings.
Personally, in the context of my app, I set enableHighAccuracy to false, in order to benefit from the browser solution, in case were the GPS wasn't enabled.
You got the WiFi geolocation working with enableHighAccuracy to false? For me it doesn't work. If I try to find the geolocation with disabled GPS on Android 4.4 nothing happens and it runs into a timeout.
and in the Android phone settings about "Position", the radio button set on "GPS only",
It ALWAYS reachs the timeout !
All users argued me that my queries were too long (more than 15 seconds in this case), but when I tell them:
"Try to set the Position mode to 'High accuracy'", they say: wow now it's fast !
Question so: why is timeout reached even when 'enableHighAccuracy: true' when using GPS ONLY ?
Here's a related stackoverflow question I found on the subject but no answer..:
@Kukiwon Did you try to install Crosswalk? Because this is remedy. Also you can create function with setinterval, at first run it will fail but next one will execute properly.
@mikeon your proposed solution using an interval did not work for me. Eventually we reinstalled Android on the phone and now it works. Looks like it was an issue with the device. Thanks again!
Activity
felquis commentedon Nov 19, 2014
@mica16 what errors you are getting with ngCordova? Because ngCordova already use the Web API ref
I'll make some tests with geolocation.
mica16 commentedon Nov 22, 2014
@felquis I tested on Samsung S5, geolocation works.
On a Samsung S4, I don't get Javascript errors...but I don't get any data. I did:
No Javascript alert is displayed at all, meaning that ngCordova doesn't return a promise in this case...
Actually, when I don't set the "Position" option (to get the local position of the phone user) on the Samsung parameter section, I don't get any data..and no errors is displayed...
I expected some errors to appear, involved by the promise.
=> can't use the app if "Position" is not set.
steefaan commentedon Dec 15, 2014
@mica16 Any updates on this? Unfortunately I can't test on Samsung Galaxy S4 but I tested it on Samsung Galaxy S3, Samsung Galaxy S5 and Galaxy Tab 4 and it works for all. The problem I have with Android 4.4 in general is that WiFi is not able to find the location. On my Samsung Galaxy S3 the WiFi geolocation works fine.
mica16 commentedon Dec 16, 2014
Hi,
Actually, I noticed that when the property
enableHighAccuracy
is set totrue
, the phone has to enabled GeoPosition, otherwise the Geolocation by the browser is not used, explaining my post above.I found it very frustrating for certain lambda users that aren't aware about their phone settings.
Personally, in the context of my app, I set
enableHighAccuracy
tofalse
, in order to benefit from the browser solution, in case were the GPS wasn't enabled.steefaan commentedon Dec 17, 2014
You got the WiFi geolocation working with
enableHighAccuracy
tofalse
? For me it doesn't work. If I try to find the geolocation with disabled GPS on Android 4.4 nothing happens and it runs into a timeout.mica16 commentedon Apr 2, 2015
I found a tricky bug:
Having this code:
and in the Android phone settings about "Position", the radio button set on "GPS only",
It ALWAYS reachs the timeout !
All users argued me that my queries were too long (more than 15 seconds in this case), but when I tell them:
"Try to set the Position mode to 'High accuracy'", they say: wow now it's fast !
Question so: why is timeout reached even when 'enableHighAccuracy: true' when using GPS ONLY ?
Here's a related stackoverflow question I found on the subject but no answer..:
http://stackoverflow.com/questions/27835425/html5-geolocation-not-working-with-gps-only-location-service-mode-on-android
And here's mine I asked:
http://stackoverflow.com/questions/29411697/timeout-about-geolocation-always-reached-when-position-mode-is-set-to-device-on
sean-hill commentedon Apr 8, 2015
I'm having this exact same issue, any updates to this?
mikeon commentedon May 8, 2015
I also, didn't find solution for that issue.
Kukiwon commentedon Jul 9, 2015
+1 seeing the same issues on Galaxy S3 mini running Android 4.4.4
mikeon commentedon Jul 9, 2015
@Kukiwon Did you try to install Crosswalk? Because this is remedy. Also you can create function with setinterval, at first run it will fail but next one will execute properly.
Kukiwon commentedon Jul 9, 2015
@mikeon yes i'm using crosswalk. I'll try using an interval for getting a location and will keep you posted.
Kukiwon commentedon Jul 10, 2015
@mikeon your proposed solution using an interval did not work for me. Eventually we reinstalled Android on the phone and now it works. Looks like it was an issue with the device. Thanks again!
askannan commentedon Sep 19, 2015
same issue as mica16... Is there a way out, or is there some other plugin that I can use?
1 remaining item