Titanium Community Questions & Answer Archive

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

Titanium.Geolocation.getCurrentPosition not working


On trying to invoke Titanium.Geolocation.getCurrentPosition, the callback is not returning. This was working prior to 1.4 release. Has this functionality been broken?


— asked August 16th 2010 by Gaurav Srivastva
  • current
  • gps
  • location
1 Comment
  • It seems to be working fine for me on iPhone. I believe, when starting up, it will initially return with the last position "saved" until it gets an update (which can take some time depending on where you are, indoors/outdoors, etc). But in any case, it always returns a position for me, at least.

    — commented August 24th 2010 by karlo kilayko

3 Answers

  • I'm not sure of your platform (android, iphone, etc.) so this might not apply. I was having troubles getting any sort of GPS data in the android emulator. Even the built-in maps app wouldn't show a location. I found a way to set mock coordinates that solved my issue. Maybe it will help you?

    First, open ddms (Dalvik Debug Monitor). On Windows, navigate to the android-sdk\tools directory and run ddms.bat. The first line in the top-left pane will read something like "emulator-####" such as emulator-5560.

    Open a command prompt window. Enter 'telnet localhost ####' substituting the number you found above. This will open a telnet window to your android emulator.

    Enter the following command (substitute your own longitude & latitude, in that order, if you'd like):

    geo fix -82.411629 28.054553

    The GPS icon will appear in the emulator's notification bar. Geolocation is now available. At this point, I could get location data in my app and in other apps, such as Maps.

    You don't have to leave the telnet session running. Closing it doesn't turn off the GPS.

    I hope this helps.

    — answered August 24th 2010 by Tim Poulsen
  • +1 - I'm having this problem too.

    — answered August 18th 2010 by Troy Taylor
  • Hey, I am still having the same problem. It only happens on 3G. For some reason, the callback for getCurrentPosition does not get called at when I am on 3G, works perfectly on wifi.

    Any help is greatly appreciated.

    — answered March 16th 2011 by Suchit Agarwal
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.