Titanium Community Questions & Answer Archive

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

iPhone never accesses GPS


I built a GPS-Tracker by modifying the kitchensink-geolocation sample.

Works great with my Android Desire but on the iPhone even the
kitchensink always gives me accuracy of >=500. It seems to me
that it never returns GPS-data but celltower(or WIFI) locations.

Yes, I activated

Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST; Titanium.Geolocation.preferredProvider = Titanium.Geolocation.PROVIDER_GPS;

and also set Ti.Geolocation.purpose and distance filter to 1.

Working on iPhone 3g with iOS 4.1 and Titanium version 1.4.1

I read the forum up and down about this, but I could not get it working, i startet kicking things around and biting in the table.

Google maps and native build GPS tracker work fine, so the phone even so it's old 3g seems OK.

Thanks for reading…


— asked November 17th 2010 by Werner Bogula
  • 1.4.1
  • accuracy
  • error
  • geolocation
  • gps
  • iphone

3 Answers

  • Accepted Answer

    Show the rest of your code

    — answered November 17th 2010 by Josh Lewis
  • Hi Josh,

    thank you for the instant reaction:

    Here's the code:


    Everything is like in the kitchensink sample,
    I just add up the lines of "lat;lng;speed;alt" in a textview and write it out to a file.

    This works OK on Android (emulator and device) but not on iphone,
    unfortunately I can't test it in the iPhone-emulator, because I don't know, how to emulate changing geodata (which is quite easy in Android with telnet and geo fix).

    I also tried to call getcurrentPosition() consecutevly in a timerloop,
    which also worked in Android, but not on iPhone.

    Another thing to mention: I implemented the function as a modal window, that is directly generated in app.js to have it running as a standalone process. (So that it continues to work in Android multitasking)

    I can't find any flaw in the code, as it is the same as in the latest kitchensink, which also always results in accuracies >=500.

    I walked my neighbourhood every half hour to check it, the only thing I caught is a cold.

    Thanks for helping me

    — answered November 17th 2010 by Werner Bogula
  • Copied project to total new,
    recompiled everything with overnightly build 1.5 target iOS 4.1
    AND (according to a post somewhere here)
    added a map view for checking current location.

    Now it works like a charm…

    Will check if the mapview is necessary, as soon as I got some sleep…


    — answered November 20th 2010 by Werner Bogula
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.