Software Archive
Read-only legacy content
17061 Discussions

Geolocation Issue

Rahul_T_
Beginner
608 Views

Hello there..  I am trying to make a simple app that displays lat and long when a button is pressed.. Im trying to learn through the process..

Wrote the code, but when I try to emulate on iOS and android everything works fine.

when I move to test via wifi using app preview on smartphone:

1. works perfectly on iPhone 5

2. nothing on android samsung i9300

I am using latest cordova plugin. I even loaded the index.html file in safari, works fine.. only no luck on android

I have already tried solutions from faq https://software.intel.com/en-us/xdk/faqs/cordova Q21..

my biggest issue is I do not have iOS developer account so I cannot build an iOS app. I am relying on android and the irony is the code doesn't work. I even tried building several apt with different permutations in code like disabling highAccuracy, timeout, etc.

0 Kudos
6 Replies
PaulF_IntelCorp
Employee
608 Views

Please download and "open" this sample app for a guide: https://github.com/xmnboy/hello-cordova/archive/xdk-2323.zip (do not use the "import" feature in the XDK, use the "open an Intel XDK project" button at the bottom left of the Projects tab. Also, there is a tutorial for the app: https://github.com/xmnboy/hello-cordova/blob/xdk-2323/docs/README.md

You can test this app using App Preview and an iOS device to get a better understanding of how geolocation works -- so you don't need a developers account to test geo.

0 Kudos
Rahul_T_
Beginner
608 Views

Hello. Thank you for your reply. 

I was successful in testing on IOS, works fine but when I test on android the same code doesnt work

I need to build the app as a standalone app.  So i want to create an .apk file. Any clue on why it doesn't work on android?

do I need to add permissions or someting?  I am writing app using blank template standard html+ cordova

I tried both xdk and xdk iot version IDE

0 Kudos
Rahul_T_
Beginner
608 Views

Paul F. (Intel) wrote:

Please download and "open" this sample app for a guide: https://github.com/xmnboy/hello-cordova/archive/xdk-2323.zip (do not use the "import" feature in the XDK, use the "open an Intel XDK project" button at the bottom left of the Projects tab. Also, there is a tutorial for the app: https://github.com/xmnboy/hello-cordova/blob/xdk-2323/docs/README.md

You can test this app using App Preview and an iOS device to get a better understanding of how geolocation works -- so you don't need a developers account to test geo.

Hey i tried the app.. Accelerometer, Compass works but geolocation does. neither fine nor coarse. returns timeout error.
funny thing, this app doesn't even work in test mode over wifi on my iPhone via app preview

however writing a simple html file to load lat and long works  in test mode on iPhone but not android.. weird.. can someone help me please??????

i am really frustrated. I need to make an android app that works offline and be able to load geolocation

 

0 Kudos
Rahul_T_
Beginner
608 Views

I tried the hello cordova app. Accelerometer And compass work fine. However geolocation both fine and coarse return TIMEOUT error. I tried modifying timeout to infinity but still no luck. I need to make an android apk that works offline. The app must be able to load geolocation-- highAccuracy enabled. 

When I test on iphone, over wifi via app preview my code works fine

however when i use android, nothing happens, I don't even get a notofication saying app is requiring location services. Weird. Can someone please help me out? The only thing I require for my project is not working and its wearing me out

0 Kudos
PaulF_IntelCorp
Employee
608 Views

See the tutorial associated with the sample app, not all Android devices work with fine geo requests AND the end user can disable geo access. see the last paragraph of the tutorial:

NOTE: that not all devices are guaranteed to include the hardware necessary to use all the features of this simple "hello-cordova" application. For example, it is quite common to encounter devices that do not include compass or GPS hardware. In that case the "Compass" button will not read any data and the precision of the GPS data may be quite low or non-existent. The precise capabilities of geolocation hardware in Android devices can vary widely. In addition, the ability to read geolocation data on a real device can also be restricted by the Android "Location" settings, or mode. For example, if a device includes GPS hardware but that GPS hardware has been disabled in the Android settings, it may result in no "fine" geolocation data being returned from the device, or the data may be identical to the "coarse" geolocation data results.

0 Kudos
John_H_Intel2
Employee
608 Views

Did you recently update your device?

I seem to remember another user having geolocation issues when they updated their device. The new Android OS required them specifically enable geolocation on the device under settings.

0 Kudos
Reply