6

I am developing an iOS 4 + application, which can transmit accelerometry data collected on an iPhone to a server. The app should collect data even when the application enters in background (I want to know the person’s movements).

After doing some research on the Internet, I learned that the app is killed 10 minutes after being closed, and it is not possible to implement it the same way as on Android (using services).

Only some tasks can run in background like an audio player, VOIP or geolocation. I read somewhere on the Internet that we can use workarounds for letting the application running in background. It uses the audio player, which plays a mute sound. However, this workaround seems not to be accepted by Apple.

Do you see any solution to my problem?

appsofiane
  • 103
  • 2
  • 7
  • possible duplicate of [How Nike+ GPS on iPhone receives accelerometer updates in the background?](http://stackoverflow.com/questions/8716466/how-nike-gps-on-iphone-receives-accelerometer-updates-in-the-background) – Bo Persson Aug 25 '12 at 13:37

3 Answers3

9

If you register your app to listen to location, and use CoreMotion, you can get accelerometer data in background.

This is duplicate with: How Nike+ GPS on iPhone receives accelerometer updates in the background?

Community
  • 1
  • 1
Aapo Kyrola
  • 1,100
  • 8
  • 8
0

From iOS 9.0 we got CMSensorRecorder that can record accelerometer data at 50Hz even if app is killed. More info as usual in Apple documentation.

CMSensor documentation

Juraj Antas
  • 3,059
  • 27
  • 37
-2

The accellerometer is not available for background threads. Read this MacWorld article on what is possible and what not.

Hugo
  • 494
  • 2
  • 7