health-samples
health-samples copied to clipboard
Using Synthetic Data on Wear OS 4
The docs on the repo for using synthetic data state to use adb
; however, the docs for Wear OS 4 say that is no longer needed and that the emulator now natively supports these events.
How do I control the emulator to walk vs run, etc? I tried this slider in the emulator extended controls, but it seems to have no effect:
Does this repo work with Wear OS 4 and if so what are the steps for synthetic data on that OS?
We need to update the instructions in the sample--thanks for pointing that out! The docs from your second link are the best resource for synthetic data generation with Wear 4.
If you are using the latest version of the Wear 4 emulator in Android Studio Hedgehog, Health Services will automatically generate data appropriate for the exercise specified your exercise config.
If you aren't using the latest version of the emulator, you can still use the emulator extended controls for Heart Rate, but the emulator has to be running in a separate window.
Android Studio Hedgehog
It doesn't look like Hedgehog is released yet. I am on Giraffe. Will this work with Giraffe?
the exercise specified your exercise config
What is an exercise config?
running in a separate window
What do you mean here? Is this as simple as "popping" out the window within Android studio?
- You can download Hedgehog here. If you can't download Hedgehog, you can still generate data in Giraffe, it just takes a few extra steps: Enable developer options, then run this command:
adb shell am broadcast \ -a "whs.USE_SYNTHETIC_HAL" \ com.google.android.wearable.healthservices
This will kick start the behavior on Wear 4 emulators outside of Hedgehog.
-
The exercise config is where you can specify the exercise type. The synthetic data generation will change based on the type of exercise and other behavior you've specified there.
-
Yep, you can specify this behavior from Settings > Emulator > deselect Launch in Running Devices Tool Window
Health Services will automatically generate data appropriate for the exercise specified your exercise config. The exercise config is where you can specify the exercise type. The synthetic data generation will change based on the type of exercise and other behavior you've specified there.
Okay, but what about in the case that I am testing out either spot measurements or passive (background monitoring)? In those cases how do I specify the synthetic data to generate?
And in the case of a "run" exercise, Is there some equivalent to saying I want "running" vs "walking" speed (ie what existed in Wear OS 3)? i.e. from external to the code it self, to control the synthetic data being piped in
adb shell am broadcast \ -a "whs.USE_SYNTHETIC_HAL" \ com.google.android.wearable.healthservices
After running that code, do I then use the same adb broadcast
as I would in the Wear OS 3 instructions?
You can simulate passive events (such as sleeping, fall detection), but can't simulate passive data generation.
The team is working on implementing support for custom values in Wear 4, but it isn't supported yet.
After running that code, do I then use the same adb broadcast as I would in the Wear OS 3 instructions?
If developer options are enabled, data should be automatically generated, without the need to run any additional commands.
So I am trying to run the MeasureDataCompose
app with synthetic data. I have upgraded to hedgehog, upgraded the emulator to the newest version and set this in the extended controls:
However I am not seeing that value reported by the app.
I also ran adb shell am broadcast \ -a "whs.USE_SYNTHETIC_HAL" \ com.google.android.wearable.healthservices
Do I also need to pop-out the emulator and / or turn on developer settings (on the watch?)?
The extended emulator controls are separate from synthetic data generated by Health Services. I can check with the emulator team regarding the expected behavior in Hedgehog + Wear 4 (just tested with the Wear 3 emulator, and the app is responding to the extended controls). Can you confirm if you're seeing any values at all (perhaps the ones automatically generated by Health Services?).
If you're on hedgehog and have downloaded the SDK updates, you don't need to run the command, it's only for pre-Hedgehog Android Studio.
In the MeasureDataCompose
app, I am seeing BPM values that seem to step linearly from 60 to 150 (all marked with low accuracy).