- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
I'm having an issue with Cordova's Geolocation plugin on Android devices (and the emulator too).
First off the plugin works fine on the iphone emulator but when I try to get my location using the code:
var suc = function(p){ if (p.coords.latitude != undefined) { if(!is_requesting) findEvents(p.coords.latitude, p.coords.longitude, isForMap); } }; var fail = function(errorObj){ alert("geolocation failed"); }; var options = { maximumAge: 90000, timeout: 50000, enableHighAccuracy: true }; navigator.geolocation.getCurrentPosition(suc,fail,options);
On Android this just times out and give me the error object message:
"Timeout expired"
I've tried setting enableHighAccuracy to true (and false) but neither seems to fix my problem.
Any help on this would be greatly appreciated!!!
Many thanks!
- Tags:
- HTML5
- Intel® XDK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please take a look at Question 21 on the this FAQs page and see if it is of help to you: https://software.intel.com/en-us/xdk/faqs/cordova
Q21: How do I resolve Geolocation issues with Cordova [Plugin]
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you enable to Cordova geolocation plugin?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes I enabled the geolocation plugin as the plugin works fine on iPhone emulators....
Only on the android emulators and phones, I am unable to get a geolocation...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please take a look at Question 21 on the this FAQs page and see if it is of help to you: https://software.intel.com/en-us/xdk/faqs/cordova
Q21: How do I resolve Geolocation issues with Cordova [Plugin]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Anusha!
Weirdly enough, when I actually built the app and installed it on my phone (so not using the emulator) the app was able to retrieve a GPS coordinate so I think that possibly the plugin may not work on the emulator!
Thanks again tho, that FAQ looks really useful!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am glad it worked out for you and Thank You for your support!

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page