android / health-samples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

exerciseState.isEnding is not appearing

zendoclab opened this issue · comments

with emulator(0.0.6), exerciseState.isEnding appear and It work properly to navigate to summary by pressing END button

but with GW4/5 (healthservices 0.18., android 11, API 30) and emulator(0.14., android 11, API 30) to test exercisesamplecompose,
exerciseState.isEnding dont't appear, rarely appeared at emulator, never at GW4/5
ACTIVE to ENDED, or ACTIVE TO briefly PAUSING/PAUSED TO ENDED when I press END button

os I change the code like:
if (exerciseStateChange.exerciseState.isEnding) ->
if (exerciseStateChange.exerciseState.isEnded && activeDuration.toKotlinDuration().isPositive())
why I put activeDuration is that it prevent to end at the very begining with chance of having exerciseState.isEnded initially

it works well but Do you think this could cause problem?

Hi, yes I'm observing the same behavior. Thanks for opening the issue.

I think that fix works well for the Galaxy Watch. For the emulator, I observed Health Services crashing when trying to end a workout and it appears that changing the line to exerciseStateChange.exerciseState.isEnded || exerciseStateChange.exerciseState.isEnding captures both ending states.

Give it a try and let me know what you think! I'm working on a larger change to the sample that will also include this, but if you want to submit a PR to the sample to address this fix, please feel free.

Hi @zendoclab we've updated the sample. The issue should also be fixed on the Galaxy Watch WHS implementation itself where ending the exercise should take the device through the appropriate exerciseStateChanges.