Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15930] Getting stale location if providers turned off , irrespective of LocationRule

GitHub Issuen/a
TypeBug
Priorityn/a
StatusReopened
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, geolocation
ReporterAbhinav Tyagi
AssigneeUnknown
Created2013-02-11T17:37:53.000+0000
Updated2018-02-28T20:04:00.000+0000

Description

If the registered providers are turned off in settings , a stale location is returned and the Rules dont handle it even if it is very old. For eg. If I have registered for GPS and Network only , and both are turned off on phone , last known location is returned which can be very old and maxAge set in rules doesn't block it. Also this cached location has provider set as the original provider (i.e. gps or network) which actually should be passive. EDIT Feb 13 2013:
Titanium.Geolocation.Android.manualMode = true;
	
	
	var providerGps = Ti.Geolocation.Android.createLocationProvider(
				{
    				   name: Ti.Geolocation.PROVIDER_GPS,
				});
				
	
	var providerNetwork = Ti.Geolocation.Android.createLocationProvider(
				{
    				    name: Ti.Geolocation.PROVIDER_NETWORK,	
				});
	//add the providers
	Ti.Geolocation.Android.addLocationProvider(providerGps);
	Ti.Geolocation.Android.addLocationProvider(providerNetwork);
	
	var maxAgeMili = 1 * 60 * 1000;  // 1 minute
	var minAgeMili = 1 * 1000;		//1 second
	
	var gpsRule = Ti.Geolocation.Android.createLocationRule(
						{
    						  provider: Ti.Geolocation.PROVIDER_GPS,
    						  accuracy: 50,
    						  maxAge: maxAgeMili,
    						  minAge: minAgeMili
						});
	var networkRule = Ti.Geolocation.Android.createLocationRule(
						{
    						  provider: Ti.Geolocation.PROVIDER_NETWORK,
    						  accuracy: 50,
    						  maxAge: maxAgeMili,
    						  minAge: minAgeMili
						});
	Ti.Geolocation.Android.addLocationRule(gpsRule);
	Ti.Geolocation.Android.addLocationRule(networkRule);
Titanium.Geolocation.addEventListener('location',function(e){
           //Process location
});
Now while testing the above code on android device (using Samsung Galaxy ACE) , if both the location providers are turned off (i.e. GPS and network) in settings , we receive a stale location . That location should have been filtered by rules but in this case does not happen. Also the provider set in the received location is 'gps' or 'network' which should now be 'passive'.

Comments

  1. Carter Lathrop 2013-02-12

    Can you please provide a test case that shows this bug, unable to reproduce without more information. Thank you
  2. Abhinav Tyagi 2013-02-13

    Edited the description. Please let me know if further information is needed.

JSON Source