2
votes

I start device motion updates in the foreground. When I put the app to background by locking the phone, I continue to get updates but when I unlock my phone, device motion stops updating. Accelerometer,gyroscope and location updates are working fine both in background and when I bring it back to foreground.

I am using CMMotionManager for getting accelerometer,gyroscope and device motion. I am reading the pitch, roll and yaw values from Device Motion.

1

1 Answers

-1
votes

Try SOMotionDetector. This is very helpful library. This will work on both cases foreground & background. https://github.com/SocialObjects-Software/SOMotionDetector