Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11831] iOS: GPS icon not turning off when app enters background

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2013-02-19T18:22:39.000+0000
Affected Version/sRelease 2.1.3
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterChristopher Stea
AssigneeIngo Muschenetz
Created2012-11-08T22:27:51.000+0000
Updated2017-03-24T17:11:00.000+0000

Description

*Problem description* In kitchen sink, when you run Geolocation and hit the home button, the GPS icon will not turn off. All location listeners have been removed and Xcode Instruments confirms the GPS is turned off and there is no battery drain, yet the icon still appears as if it were turned on. Force closing the app or restarting the phone doesn't make it go away. Only disabling location services, or uninstalling the app makes the icon disappear. *Workaround* I have been able to fix the issue by editing Geolocation.mm, and adding [locationManager setDelegate: nil] before RELEASE_TO_NIL_AUTORELEASE(locationManager) in shutdownLocationManager() *Notes* - This issue can only be replicated on IPhone 4/4S running 5.1 or 6.0 - Cannot be replicated on Android, iPad, or the iOS 5.1/6.0 Simulator To be safe, I also created a VM with a clean install of MacOSX Lion, Xcode 4.2.1 and Titanium 2.0.0 and I was still able to replicate the issue. This was to discard the possibility of it being a corruption issue, bad install, or a recent framework/Xcode change. *Test case*
var mapView = Titanium.Map.createView({
	mapType : Titanium.Map.STANDARD_TYPE,
	animate : true,
	regionFit : true,
	userLocation : true,
	annotations : []
});
var win = Ti.UI.createWindow();
win.add(mapView);
win.open();

Comments

  1. Daniel Sefton 2012-11-20

    Christopher: I realise that it was not yet confirmed whether this issue occurred for you in the very latest 3.0.0 (grab it at http://builds.appcelerator.com.s3.amazonaws.com/index.html ). I have moved this to TiMob, but in the meantime could you clarify this?
  2. Christopher Stea 2012-12-10

    This bug may be invalid and could be related to the OS. I was able to also fix the issue by going to Settings > General > Reset > Reset Privacy and Location. Once I do this, the app starts behaving correctly and the location services indicator turns off.
  3. Joe Falcone 2013-02-18

    There is definitely a problem with the 2.x SDK on iPhone 4 running 6.0 (my configuration). I have code which does Ti.Geolocation.removeEventListener('location', ...) when the app is paused and it has no effect on the GPS icon. Rather disturbingly, if I turn off Location Services for everything else on the phone, and just turn Location Services on and off for my app (which I ran once, paused and then stopped), I can toggle the GPS icon on and off. So something is wrong here. I will test with the 3.0 SDK to see if there is any difference.
  4. Joe Falcone 2013-02-18

    The console log for the above behavior: (for some reason cut and paste isn't working so I'm having to type these in...) locationd[46] : Location icon should now be in state 'Active' awdd[4493] : libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary awdd[4493] : CoreLocation: CLClient is deprecated...
  5. Joe Falcone 2013-02-19

    Same behavior with 3.0 SDK. I'm actually running iOS 6.1 on an iPhone 4. Also same console log file entries when I toggle Location Services for my app in Settings >> Privacy.
  6. Joe Falcone 2013-02-19

    And I guess the question may really be: What does the GPS icon mean in the Status Bar? Does it mean that GPS is actually running and active? Or Does it just mean that there are some apps or system services which have been active and which may use GPS if activated again.
  7. Joe Falcone 2013-02-19

    OK, figured out what is going on - to "turn off" the GPS icon, one must 1. remove the event listener from the "location" event 2. turn off anything else that might be assisting with geolocation, e.g., Ti.Geolocation.trackSignificantLocationChange Once I had done both of these, the GPS icon turned on and off as expected. So I don't think this is a bug.
  8. Daniel Sefton 2013-02-19

    Thanks for the clarification Joe. I think it's now safe to conclude that it's not a bug, and your workaround should help anyone else who has the same problem, so I'll resolve.
  9. Lee Morris 2017-03-24

    Closing ticket as invalid with reference to the above comments.

JSON Source