A quick wear os 3 health service related question: I intend to design a service for my health app to...
y
A quick wear os 3 health service related question: I intend to design a service for my health app to collect heart rate data 24/7 using PassiveListenerService from a TileService. Will this work? There are a lot of background service restrictions on Galaxy Watch and Pixel Watch, the only service running 24/7 on Wear 2 is the watchface service, can tile service also survive the energy optimisation? I noticed that the pixel watch is constantly measuring heart rate data, can i retrieve the heart rate data retrospectively ?
a
The tile service won't stay alive and it should do its work quickly. I don't think the continuous heart rate is exposed to 3rd party apps on the Pixel. I would search for a feature request on Issue Tracker and +1 it, or add a new one
y
How about a complication? Will it stay alive if i use the passive data callback to collect heart rate data from complication?
a
Nope
y
Thanks, it is a feature request i guess 🙂
I have opened a feature request at (https://issuetracker.google.com/issues/261239556), looking forward to your support with a +1.
a
Do you have a mobile app too?
y
Yes, it is the stila app, which helps user track their stress 24/7 https://play.google.com/store/apps/details?id=lmu.pms.stila&hl=en&gl=US
a
I suspect this is the sort of thing that should be going through Health Connect, although I'm not sure if the data is published there yet.
I'm not sure how the continuous heart rate works tbh
y
I will be open for that (health connect). My goal is to decouple the continuous data measurement from the custom watchface, it will also help to efficiently use the watch battery, if google / wear os platform can centralize it. The health service is great and it allows continuous background measurement, it would be great 3rd part app can also benefit from it.
a
Ah so Stila on Wear is a watch face app. Is that watchface service part of a wider app?
y
Yes, it is. I use custom watchface to store the heart rate data via SensorManager from HAL, and process it with ML model on the Android Phone to predict stress, it is a companion app. You can find more about Stila app from https://developer.android.com/helpful-innovation#stila-section
a
What's HAL?
l
Harware Abstraction Layer, an Android OS thing
y
HAL is the android Hardware Abstraction Layer, Louis is quick than me 🙂 https://source.android.com/docs/core/architecture/hal
Before the
Health Service
, i need to do a lot of things manually with SensorManager, and to use some un-documented features from Android Hardware Abstraction Layer 🙂