auto workout detection with custom activity classifier

I'm building a watch app that uses a custom ml activity classifier for detecting certain activities performed by the user.
I want to prompt the user to start tracking an activity whenever it is detected by the classifier, even when the app is not running (like auto workout detection in the Apple Watch).

Any idea if/how this can be done? Thanks!

Replies

Think about Apple's new hand washing detection, a developer probably wouldn't be able to achieve this given the public API set; as you pointed out we don't get 'always' motion updates. To speculate, their ML model probably uses acceleration, hand position, sound, and other factors as input into their classifier.

Is your application health or fitness related? If so, given your legitimate use case for accessing the users Health and Fitness data, you could perform a long running query with background updates for something like Step Count or distanceWalkingRunning updates.

https://developer.apple.com/documentation/healthkit/hkhealthstore/1614175-enablebackgrounddelivery

Do note, as the documentation states, some of the data is 'throttled' to so many updates over time. Hope this helps.