https://kotlinlang.org logo
#compose-wear
Title
# compose-wear
y

Yingding Wang

01/13/2023, 12:36 AM
I would like to implement an
exercise timer
feature with compose wear that user can start and stop the exercise. Is there any example for this? What are the options and recommendations on wear? App Widgets, Tiles, Music App like Always on App? Horologist or Glance? Thanks for any hints.
y

yschimke

01/13/2023, 12:41 AM
Tile and Complication work. I think favour Tiles Material over glance, given it's Alpha state. Horologist has helpers for both tiles and complications.
Look at ongoing activities for something running in the background.
y

Yingding Wang

01/13/2023, 12:46 AM
Thanks, I will try Tiles Material from Horologist and ongoing activities as recommended, which may give more viewports than that of the complication.
y

yschimke

01/13/2023, 12:47 AM
Tiles Material is an androidx lib.
The functionality in horologist helps with testing, previews and sharing Compose Canvas code with the app and tile.
y

Yingding Wang

01/13/2023, 12:51 AM
thanks, it looks great. Can the tile also be synced with mobile app widget somehow? I see some music player has this feature.
y

yschimke

01/13/2023, 1:26 AM
Via the data layer, yes. Or through your server/firebase AKA the cloud
f
y

Yingding Wang

01/13/2023, 9:31 AM
@florent Thank you very much. The exercise example looks great. It seems to use ongoing activity, always on activity and custom services.
f

florent

01/13/2023, 6:47 PM
You can use compose already if you use glance
y

Yingding Wang

01/13/2023, 6:48 PM
Is it not still in alpha? How is your experience with glance, does it support your daily work well?
I looked through an example of Glance, https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:glance/g[…]a/androidx/glance/wear/tiles/demos/CurvedLayoutTileService.kt Which is really simple compared to TileMaterial, I think i will stick with TileMaterial still due to the alpha stage of glance.
j

John Nichol

01/14/2023, 8:17 AM
Glance is still early days, and while it uses compose runtime it is different from building compose UI apps as you don't have the same state model. Glance is still in very early stages of development and doesn't have all of the features available in Tiles. I would stick to Tiles Material for now
50 Views