Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Synthetic Data on Wear OS 4 #183

Open
cancan101 opened this issue Oct 23, 2023 · 8 comments
Open

Using Synthetic Data on Wear OS 4 #183

cancan101 opened this issue Oct 23, 2023 · 8 comments

Comments

@cancan101
Copy link
Contributor

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:
image

Does this repo work with Wear OS 4 and if so what are the steps for synthetic data on that OS?

@breanatate
Copy link
Collaborator

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.

@cancan101
Copy link
Contributor Author

cancan101 commented Oct 24, 2023

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?

@breanatate
Copy link
Collaborator

  1. 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.

  1. 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.

  2. Yep, you can specify this behavior from Settings > Emulator > deselect Launch in Running Devices Tool Window

@cancan101
Copy link
Contributor Author

cancan101 commented Oct 24, 2023

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?

@breanatate
Copy link
Collaborator

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.

@cancan101
Copy link
Contributor Author

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:
image
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?)?

@breanatate
Copy link
Collaborator

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.

@cancan101
Copy link
Contributor Author

cancan101 commented Oct 24, 2023

In the MeasureDataCompose app, I am seeing BPM values that seem to step linearly from 60 to 150 (all marked with low accuracy).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants