Titanium Community Questions & Answer Archive

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

GPS cuts out sporadically (android)

In my app which uses GPS, and in the kitchensink geolocation app itself, the GPS appears to sporadically turn on and off. On my driod if I watch the status bar I can see the gps radio icon go on and off. Compare this to googles navigation app for android which turns the gps radio on and leaves it on.

The fact that the radio goes off and on almost religiously leads me to believe that it may be a bug. It always comes back online very quickly, but sometimes while it is offline it causes my tracking app to skip steps.

Can someone confirm what might be causing this to happen?

— asked October 19th 2010 by Anthony Webb
  • android
  • geolocation
  • gps
0 Comments

4 Answers

  • Look in the Trace level log to see what might be occurring.

    — answered October 19th 2010 by Don Thorp
    permalink
    2 Comments
    • I went through the trace logs and cannot see any errors or anything, seems like everything is running fine. There are entries for "libgps" calling GpsInterface_stop() then right away GpsInterface_start() about every 10 seconds though. Let me distill a simple app down for you that does this. (although perhaps the simplest way to duplicate is to fire up the kitchen sink, it does it as well)

      — commented October 19th 2010 by Anthony Webb
    • Here is a small sample app.js that has the problem. Load and wait for 10-20 seconds and the GPS will start shutting off then back on.
      http://pastie.org/1233923

      — commented October 19th 2010 by Anthony Webb
  • Added ticket: https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobile/tickets/2139-gps-cuts-out-sporadically

    — answered October 20th 2010 by Anthony Webb
    permalink
    1 Comment
    • It was converted to TIMOB-2139, which was closed prematurely. This is still an issue with 1.8.0.v….

      — commented September 21st 2011 by Shawn Lipscomb
  • In case anyone runs across this, attached is the ticket for this in lighthouse. Still no love though, this one is driving me nuts:

    https://appcelerator.lighthouseapp.com/projects/32238/tickets/2139-gps-cuts-out-sporadically

    And the code:

    http://pastie.org/1248564

    — answered November 14th 2010 by Anthony Webb
    permalink
    0 Comments
  • This is not documented but I found that setting "Ti.Geolocation.frequency=1;" solves this problem. The default appears to be 5. From the best I can tell, this is the number of seconds between cycles. Make sure to do this before adding the 'heading' and 'location' event listeners.

    — answered December 7th 2011 by Pete Berry
    permalink
    0 Comments
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.