Wear OS Tiles: How would one update UI dynamically

Viewed 205

So I am working to build media tile, but whenever I play the a next song and use getUpdater(applicationContext).requestUpdate(MyTileService::class.java) it take few seconds before it refreshes the tile, so the next song starts but, the content of the tile do not change. I tries passing the new song title in the tile refresh code, but the tile refreshes before the variable refresh.

when(request.state!!.lastClickableId) {
    "play" -> pauseLayout(songTitle_txt!!,request.deviceParameters!!)
    "pause" -> playLayout(songTitle_txt!!,request.deviceParameters!!)
    else ->pauseLayout(songTitle_txt!!,request.deviceParameters!!)
}

I am also trying to figure how to update the ARC using the song progress, I can archived it the actual Wear OS app, but confused when it comes to tiles. Can one get a reference to the tile elements and only update those ?

1 Answers

I think onclick actions might be different, but if an external event (play time, song name after it changes) is the trigger you will be limited in how often you can update.

See https://stackoverflow.com/a/70565444/1542667

Related