[TIMOB-923] Android: Test getCurrentPosition() w/o Location enabled
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Trivial |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2012-07-25T15:27:42.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | android, defect |
Reporter | Don Thorp |
Assignee | Bill Dawson |
Created | 2011-04-15T02:39:16.000+0000 |
Updated | 2012-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.
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.
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.
I've verified that in Geolocation.m there is no exception thrown.
Cannot reproduce.