Titanium Community Questions & Answer Archive

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

Android Device Geolocation Error

On a few Android devices, using several versions of mobile SDK, I am getting the error: "location is currently unavailable".

I am used to seeing this in the emulator, but what is it doing on the device? I have GPS turned on. This happens to my app & the kitchen sink.

Any ideas?

— asked November 24th 2010 by Mike Robinson
  • android
  • device
  • geolocation
  • gps

1 Answer

  • After some experimenting, I commented out the following line of code and it works.

    //Titanium.Geolocation.preferredProvider = Titanium.Geolocation.PROVIDER_GPS;

    I'm guessing since I am inside a building and the GPS satellites aren't really available it is failing….and not reverting back to the network provider. I would think the property with a name like "Preferred Provider" would be just that a "Preferred" and not "Required" provider. Let me know if anyone has anything to add.

    — answered November 24th 2010 by Mike Robinson
    • It's very common to get multiple error results until the GPS has a fix, is it a case of returns immediately w/ it commented out and with it in, it eventually does, or just always errors out.

      — commented November 24th 2010 by Don Thorp
    • Thanks for a heads up on multiple errors until a fix happens. It seems like with setting provider I get an instant failure and with no provider instant success (when I'm inside with no satellite available). Anyways, I have it working well enough for my purposes now…though the condition was a little confusing.

      — commented November 26th 2010 by Mike Robinson
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.