- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi - I'm using the getCurrentPosition method in an XDK build, using the Intel example code (see below).It works fine and returns good latitude and longitude, but fails to return the failure, even with gps, wifi and cellular all turned off (Samsung S3). Instead it just hangs. I guess I could write a JS timeout function, but the thread nature of JS processing makes this a bit problematic. Any ideas?
var getLocation = function()
{
var suc = function(p){
alert("geolocation success");
if (p.coords.latitude != undefined)
{
currentLatitude = p.coords.latitude;
currentLongitude = p.coords.longitude;
}
};
var fail = function(){
alert("geolocation failed");
getLocation();
};
intel.xdk.geolocation.getCurrentPosition(suc,fail);
}
Many thanks - Alan
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are some issues, especially with Samsung devices, and geo data. A fix has been proposed but not yet implemented. This is a general issue with Android devices that varies with the manufacturer. If you search StackOverflow for PhoneGap or Cordova issues related to gps you'll find a variety of solutions. I believe the proposed fix to our container will show up near the end of March, but since it is so hard to test over the wide variety of devices out there, it's not possible to guarantee it will resolve all gps issues.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Paul F.
Is the geolocation problem yet solved. I am having the same problem as previously posted, Geolocation is not working on android phones but is working on the emulator. I am using navigator.geolocation.getCurrentPosition for locating the position.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using geolocation plugin with sucess, Android and iOS. No problem on devices. You can see:
- https://play.google.com/store/apps/details?id=com.hamiltonhtsnet.com.br.faleparaowhatsapp
- https://play.google.com/store/apps/details?id=com.hamiltonhtsnet.com.br.fraseprontawhatsapp
- https://play.google.com/store/apps/details?id=com.hamiltonhtsnet.com.br.meurastro
Always CLI 4.2.1 and CW14
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
You need to manually switch on the permissions on Android inorder to enable Location. Go to settings, select location and turn it on.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yonas, try the "Hello-Cordova" sample to make sure geo works. It provides a very good example of geo and allows you to see if it works or does not work on a specific device.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had major issues on Sony Xperia, it just would not process the Geolocation details, it just sat there doing nothing.
I had to add var options = { enableHighAccuracy: true }; but the knock on effect is that saving the data can take 4 or 5 seconds where as on other devices the data will save in a fraction of a second.
function getLocation(){
var options = { enableHighAccuracy: true };
if (navigator.geolocation){
navigator.geolocation.getCurrentPosition(saveReading, onError,options);
}
else
{
navigator.notification.alert("Cannot get Geolocation Data.");
}
}
function onError(error) {
navigator.notification.alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n');
}

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