GlanceTileService
Class
Android
public abstract class GlanceTileService(
private val errorUiLayout: LayoutElementBuilders.LayoutElement? = errorUiLayout()
) : TileService()
TileService
which can consume a Glance composition, convert it to a Wear Tile, and
provide it to the system. You must implement the Content
function to provide your Tile
layout, for example:
class MyTile: GlanceTileService() { @Composable @GlanceComposable override fun Content { Text("Hello World!") }
}
You must also register ComposeTileService instances in your manifest to allow the system to
discover them. Your service must include an intent filter for the action
androidx.wear.tiles.action.BIND_TILE_PROVIDER
, and require the permission
com.google.android.wearable.permission.BIND_TILE_PROVIDER
.
updated with an error UI using the provided layout.
Parameters
errorUiLayout | If not null and an error occurs within this glance wear tile, the tile is |
Functions
public suspend fun <T> getTileState(): T
Retrieve the state of the wear tile provided by this service
public suspend fun <T> updateTileState(updateState: suspend (T) -> T): T
Update the state of the wear tile provided by this service
@Composable
@GlanceComposable
public abstract fun Content()
Override this method to set the layout to use in your Tile.