Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Location - determ active GPS signal?

Hi,

My app needs a 100% accurate latitude and longitude. I dont care if the battery gets drained because of the GPS - the need for exact location is a must.

Would this approach work?

First of all i will use the following listner to reciewe data from the gps

Titanium.Geolocation.addEventListener('heading',function(e){})

Second, I will try to force the phone to use the GPS…

Titanium.Geolocation.PROVIDER_GPS;

Third, I will fire a custom event when the e.coords.accuracy falls below 10 or is equal.

Question, is this the way to do it - or wont it work? Is there a better solution?

Regards, Joakim

— asked November 9th 2010 by Joakim Krassman
  • gps
  • location
0 Comments

3 Answers

  • The example in the kitchen sink 'geolocation.js' works fine as a cut and paste.

    — answered November 9th 2010 by Josh Lewis
    permalink
    0 Comments
  • Yes, i am all aware of the code - but my question is more about "the approach, to attack the problem". We are all aware of the fact that the GPS needs some time to get its current position, and thats why I wonder if the e.coords.accuracy - is the best way to get a hint if the gps is receiving its location?

    Joakim

    — answered November 9th 2010 by Joakim Krassman
    permalink
    0 Comments
  • I'm not sure on your app, but I have one that loads, you click an 'add location' button, and give it a description, and when you save it its already got your gps..

    — answered November 9th 2010 by Josh Lewis
    permalink
    1 Comment
    • Yes, but sometimes it uses the network to calculate your position, if it cant get an active signal from the gps - and that is not good enough for me. I need to get a position that stays within 10 meters….

      — commented November 9th 2010 by Joakim Krassman
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.