'How do I run watch os app in the background

Hello Any one know how to run a CoreMotion startDeviceMotionUpdates in the background for long period of time I basically made a coreML model to detect hair pulling(trichotillomania) motion that all works great and all,

but now I need it to run in the background even when the screen is dim and I don't just want it as a session, but basically running for ever. There is something called Extended Runtime Sessions but it does not really work it is limited for short time and wasn't able to get it to work anyways. https://developer.apple.com/documentation/watchkit/using_extended_runtime_sessions there doc are so vague and always have outdated samples.

Please any one know how to run a this in the background. Thank you



Solution 1:[1]

Not possible run application for long session in background for such task, you can just time to time awake application for ~10 seconds session every few hours.

But, look at CMSensorRecorder, it's can recording all accelerometer data even application in background or inactive.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmytro Hrebeniuk