Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

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

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionCannot Reproduce
Resolution Date2012-07-25T15:27:42.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, defect
ReporterDon Thorp
AssigneeBill Dawson
Created2011-04-15T02:39:16.000+0000
Updated2012-07-27T08:59:41.000+0000

Description

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.

Comments

  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