Thread
#compose-wear
    Venthorus

    Venthorus

    4 months ago
    With the introduction of Health Services on Wear OS and the arrival of the Pixel Watch in a few months I'm a bit surprised about the lack of guidance for Ambient Mode in Compose, which will probably be used by most fitness and medical apps to show some data during an exercise. Right now I am just setting a Boolean from onEnterAmbient() and onExitAmbient(), which then leads to hiding interactive UI elements and the progress indicator (which would otherwise update every frame). I do not handle the other methods (e.g. onUpdateAmbient()) at all; is that how it is supposed to be? It feels like I should do more. There is also a problem where Ambient Mode still is not working correctly or not as expected on the Samsung Galaxy Watch 4: When entering Ambient Mode, I receive almost no updates, so the time does not update every second (the heart rate does not update either, but that is probably an issue with the Health Services batching them despite being in Ambient Mode). At first I thought that might be an issue with Compose and handling Ambient Mode wrong (like updating the screen too often), but the Google Fit app has exactly the same problem while the Samsung Fit app works perfectly during Ambient Mode. I guess Google Fit doesn't use Compose yet and the Samsung Fit app probably has some special API access?
    Kseniia Shumelchyk

    Kseniia Shumelchyk

    4 months ago
    Hi Marius, We’re looking at adding support for ambient mode in Compose in upcoming release(s), this will come together with a compose specific guidance for ambient. For now, I’d recommend to check AlwaysOn sample, @Alex Vanyo added handling ambient mode in Compose to it: https://github.com/android/wear-os-samples/pull/189/ that may be a useful reference. I’m assuming you’ve already seen the existing guidance on DAC for ambient, so sharing just in case: [https://developer.android.com/training/wearables/principles#always-on, https://developer.android.com/training/wearables/views/always-on].