health-samples icon indicating copy to clipboard operation
health-samples copied to clipboard

Measure Data does not work in the latest version of the wear os emulator.

Open choe-apposter opened this issue 3 years ago • 12 comments

in HealthServicesManager.kt

val callback = object: MeasureCallback { override fun onAvailabilityChanged(dataType: DataType, availability: Availability) { sendBlocking(MeasureMessage.MeasureAvailabilty(availability)) }

         override fun onData(data: List<DataPoint>) {
             sendBlocking(MeasureMessage.MeasureData(data))
         }
     }

onAvailabilityChanged is called twice. (availability : ACQUIRING, UNAVAILABLE) onData is not called.

choe-apposter avatar Jul 01 '21 08:07 choe-apposter

We've recently updated the samples for the alpha02 release - there have been quite a few changes to the Health Services APIs since the Alpha01 release.

We've also updated the guide on using `MeasureClient' here.

Are you able to confirm whether you are still seeing the issue, including with the MeasureData sample?

garanj avatar Oct 13 '21 17:10 garanj

Going to close this one out for now - if the issue remains with alpha02, can reopen.

garanj avatar Nov 03 '21 22:11 garanj

hi @garanj ,

Using Android Studio Arctic Fox | 2020.3.1 Patch 3 with the wear os emulator with R global image to run samples, always shows State UNAVAILABLE. Is there any extra thing I need to do? image image

Zhuxf1111 avatar Nov 09 '21 03:11 Zhuxf1111

btw, I have tested on alpha02 and alpha03 version. same result

Zhuxf1111 avatar Nov 09 '21 03:11 Zhuxf1111

Thanks Julius for this.

Trying with the emulator just now, I get valid HR data when [enabling synthetic data][https://github.com/android/health-samples/tree/main/MeasureData#try-it-with-synthetic-data]

adb shell am broadcast \
-a "whs.USE_SYNTHETIC_PROVIDERS" \
com.google.android.wearable.healthservices

image

However, as you point out, I'm also not getting any availability updates from Health Services apart from the D/Measuring Data Sample: Availability changed: UNAVAILABLE message.

I'll need to investigate a bit as to why no messages are coming through regarding availability.

garanj avatar Nov 09 '21 14:11 garanj

I tired that and it works now. I can see HBM data now. but when I editing the Heart rate sensor value in simulator's visual sensor, I can't receive the data I set. Can you help me for that too? and where the data I get from now?

Zhuxf1111 avatar Nov 10 '21 08:11 Zhuxf1111

Hi Julius,

Apologies, for now the emulator virtual sensor configuration isn't hooked up to Health Services, though we can see that this would be a really useful feature, so will be looking at the feasibility.

To configure, take a look at the synthetic data guide

We've filed a bug for the availability message issue.

garanj avatar Nov 10 '21 10:11 garanj

ok, got it. thanks @garanj

Zhuxf1111 avatar Nov 12 '21 09:11 Zhuxf1111

Hello @garanj,

I am trying to visualize the synthetic data on the WearOS example apps you have developed but when I run the adb commands it doesn't show me anything at all. Running the ExerciseSample app for example, I can see the UI and authorize all the data necessary untill I can start an activity. As soon as I type the adb: adb shell am broadcast \ -a "whs.USE_SYNTHETIC_PROVIDERS" \ com.google.android.wearable.healthservices I get the message on terminal: "Broadcasting: Intent { act=whs.USE_SYNTHETIC_PROVIDERS flg=0x400000 pkg=com.google.android.wearable.healthservices } Broadcast completed: result=0"

When I run the command to start sending synthetic running data: adb shell am broadcast \ -a "whs.synthetic.user.START_RUNNING" \ com.google.android.wearable.healthservices I get the same messages and no feedback on the watch emulator.

Do I need to configure anything in the emulator to receive this synthetic data?

jtragtenberg avatar May 26 '22 02:05 jtragtenberg

@Zhuxf1111 @garanj @choe-apposter @ithinkihaveacat Is anyone actively solving these issues?

jtragtenberg avatar Jun 02 '22 13:06 jtragtenberg

@jtragtenberg In order for synthetic providers to work on the emulator, you need to enable developer options on the device.

We are in the process of updating the developer documentation to explain this.

Have you enabled developer options on the emulator?

garanj avatar Jun 16 '22 14:06 garanj

@jtragtenberg Documentation has been updated here : https://developer.android.com/training/wearables/health-services/synthetic-data

Which should better cover how to work with synthetic data. Does this help?

garanj avatar Jun 22 '22 12:06 garanj

Closing this issue; please create a new issue if the problem persists.

ithinkihaveacat avatar Jan 09 '23 11:01 ithinkihaveacat