Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-923] Android: Test getCurrentPosition() w/o Location enabled

GitHub Issuen/a
ResolutionCannot Reproduce
Resolution Date2012-07-25T15:27:42.000+0000
Affected Version/sn/a
Fix Version/sn/a
Labelsandroid, defect
ReporterDon Thorp
AssigneeBill Dawson


See http://developer.appcelerator.com/question/24571/get-user-location-not-working"> Q&A

Basically he put a try/catch around getCurrentPosition() because it throws an error if Location is not available. This may be working correctly. Just needs to be verified.

If working as it should, mark ticket invalide.


  1. Matthew Lenton 2011-04-15

    This appears to be quite valid, since the exception is raised due to:
    (from ti.modules.titanium.geolocation.TiLocation.java)

    • precondition: GPS is switched off on device

    • getCurrentPosition is called in the TiLocation module

    • getLastKnownLocation is null, since GPS is off

    • resulting location variable is null

    • exception "location currently unavailable' is raised

    ..and rightly so: the result of getLastKnownLocation is null, so an exception is raised. Seems logical to me.

    If this kind of call is allowed and the exception should not be raised, suggest removing the exception in this case.

  2. Don Thorp 2011-04-15

    Look through the iPhone classes and see if you can locate what they do in a similar instance. IIRC this "worked" as in didn't throw an exception on iPhone, but did on Android. The expected behavior is probably to never throw an exception but to put any errors into the error object and call it instead.

  3. Matthew Lenton 2011-04-15

    I've verified that in Geolocation.m there is no exception thrown.

  4. Ping Wang 2012-07-25

    Cannot reproduce.

JSON Source