0

I am trying to develop an app, running in the background, that will record the trip of car drivers, using the GPS of their iPhone (and accelerometer). I have implemented a trip detection system using the iPhone sensors, and it detects fine the start and the end of a trip, without having the driver to manually start and stop the trip on my app.

The issues that I am struggling to overcome are twofold:

  • The first issue to overcome is keeping the app alive in the background, because it seems that iOS kills background apps whenever the computing power/memory is needed for other foreground apps. And once the app is killed I have no way to "revive" the app, to that a current trip continues to be recorded, or the trip detection system is kept functioning.

  • The second issue is that, even if I somehow find a way to keep an app alive in the background, then if the user reboots his iPhone, then the app will definitely be killed and the only way my background service in my app is "revived" is when the user manually start my app back.

Is there any way to overcome such issues ?

NOTE: I have thought of using an iBeacon, but even this will only trigger an event which will "revive" the app, but only allows 30 seconds (or 120 seconds using some settings) for any processing, which will not be covering the entire trip time for GPS recordings. Unless there is a workaround using iBeacon which I do know about.

EDIT: The frequency ofGPS needed is 1 per second. And for Accelerometer it is ~6 times per second, in each direction (X, Y and Z).

inconnu26
  • 45
  • 6
  • 1
    You can control app when it is in the background. Go in your .plist file and add background mode for location update. It will work only if your app is in the background. BUT if user kills the app, you can't control. – Gagan_iOS Sep 29 '17 at 11:39
  • 1
    You can use significant location change monitoring in ios that will give you a location approximately every 1km last time I tested it. It will work while the application is terminated. Or you can abuse the CLRegion monitoring and place a region on top of the user (regions can have a 150m radius as a minimum) before the app goes into the background and on exiting the region place another region on top of the user. These are the only two ways to actually start up an app from the terminated state using location-based APIs – DatForis Sep 29 '17 at 11:54
  • @DatForis Thank you for your answer, but the frequency I am looking for is 1/sec in GPS and 6/sec in Accelerometer. Do you think could ever happen in background ? – inconnu26 Sep 29 '17 at 14:32
  • @Gagan_iOS By changing .plist file and add background mode, will it let me have such high frequency of data ? iOS could still kill the app automatically no ? and if the use kills the app (by swiping left the app stack) then there is no way the app can stay in background ? – inconnu26 Sep 29 '17 at 14:34
  • yes.. go for it. for ur help plz visit these links 1. https://stackoverflow.com/questions/19042894/periodic-ios-background-location-updates 2. https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html 3. http://mobileoop.com/background-location-update-programming-for-ios-7 – Gagan_iOS Sep 29 '17 at 15:00

0 Answers0