0

i am trying to find this information but so far i am unsuccessful. I know that the CLLocationManager has background capabilities. It is pretty well documented. I would like to know if the CLLocationManager is configured properly for backgrounding, will it trigger standard location updates even when the phone is locked and sleeping? and if yes, suppose that my application is not killed, does it wake it up? can i execute code to handle the location fix? I can do the test but i am afraid that my lack of knowledge will give me wrong or incomplete conclusions. This is why i am asking the community.

thanks for your time

2 Answers2

3
LocationManager = new CLLocationManager();
LocationManager.AllowsBackgroundLocationUpdates = true;

You have AllowsBackgroundLocationUpdates to true to get it working in sleep or in background mode.

Faysal Ahmed
  • 7,501
  • 5
  • 28
  • 50
Bikash
  • 368
  • 1
  • 6
  • Yes this is what i have so far: if(UIDevice.CurrentDevice.CheckSystemVersion (8, 0)) { locMgr.RequestAlwaysAuthorization (); // works in background //locMgr.RequestWhenInUseAuthorization (); // only in foreground } if (UIDevice.CurrentDevice.CheckSystemVersion (9, 0)) { locMgr.AllowsBackgroundLocationUpdates = true; } – Rabih Sarieddine Apr 11 '18 at 07:50
0
  1. Yes it can run in the background.
  2. Yes if you run it in the background it will wake your app for 30 seconds.
David S.
  • 6,567
  • 1
  • 25
  • 45
  • Thanks. Does it mean that when the CLLocationManager triggers the LocationsUpdated event, i have 30 seconds of code execution? i can't manage to find documentation on those 30 seconds. Do you have a clue? thanks for your time – Rabih Sarieddine Apr 11 '18 at 07:49