0

Currently I'm able to get updates from the accelerometer using CMAccelerometer

_motionManager.accelerometerUpdateInterval = kUpdateInterval;

[_motionManager startAccelerometerUpdatesToQueue:self.queue withHandler:
 ^(CMAccelerometerData *accelerometerData, NSError *error) {
     [(id) self setAcceleration:accelerometerData.acceleration];
     [self performSelectorOnMainThread:@selector(update) withObject:nil waitUntilDone:NO];
 }];

- (void)update {

... code to handle data ...

}

And this is working fine, however when I close my app (i.e. put it into the background not kill the instance), I no longer receive updates from my _motionManager. How do I handle this?

Apollo
  • 8,874
  • 32
  • 104
  • 192

1 Answers1

-1

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

Basically your app needs to be allowed to run in the background for other reasons.

Example:

enter image description here

Rafał Sroka
  • 39,540
  • 23
  • 113
  • 143
  • I added a screenshot how to do it. – Rafał Sroka Feb 21 '14 at 22:14
  • 1
    I checked the box like in the screenshot above but when I exit out of my app I still receive no CMMotion updates. Any idea why this is? Thanks for the help, I really appreciate it. – Apollo Feb 21 '14 at 22:22