GlanceTileService
abstract class GlanceTileService : TileService
| kotlin.Any | |||||
| ↳ | android.content.Context | ||||
| ↳ | android.content.ContextWrapper | ||||
| ↳ | android.app.Service | ||||
| ↳ | androidx.wear.tiles.TileService | ||||
| ↳ | androidx.glance.wear.tiles.GlanceTileService |
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.
Summary
Public constructors |
|---|
This function is deprecated. glance-wear-tiles is deprecated and will be removed |
Public functions |
|
|---|---|
abstract Unit |
This function is deprecated. glance-wear-tiles is deprecated and will be removed |
suspend T |
<T : Any?> This function is deprecated. glance-wear-tiles is deprecated and will be removed |
open IBinder? |
This function is deprecated. glance-wear-tiles is deprecated and will be removed |
open Unit |
This function is deprecated. glance-wear-tiles is deprecated and will be removed |
open Unit |
This function is deprecated. glance-wear-tiles is deprecated and will be removed |
open Unit |
This function is deprecated. glance-wear-tiles is deprecated and will be removed |
suspend T |
<T : Any?> This function is deprecated. glance-wear-tiles is deprecated and will be removed |
Protected functions |
|
|---|---|
final ListenableFuture<ResourceBuilders.Resources> |
This function is deprecated. glance-wear-tiles is deprecated and will be removed |
open Unit |
@CallSuperThis function is deprecated. glance-wear-tiles is deprecated and will be removed |
final ListenableFuture<TileBuilders.Tile> |
This function is deprecated. glance-wear-tiles is deprecated and will be removed |
Public properties |
|
|---|---|
open GlanceStateDefinition<*>? |
This property is deprecated. glance-wear-tiles is deprecated and will be removed |
open TimelineMode |
This property is deprecated. glance-wear-tiles is deprecated and will be removed |
Inherited functions |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Inherited properties |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Public constructors
GlanceTileService
GlanceTileService(
errorUiLayout: LayoutElementBuilders.LayoutElement? = errorUiLayout()
)
| Parameters | |
|---|---|
errorUiLayout: LayoutElementBuilders.LayoutElement? = errorUiLayout() |
If not null and an error occurs within this glance wear tile, the tile is updated with an error UI using the provided layout. |
Public functions
Content
@Composable
@GlanceComposable
abstract funContent(): Unit
Override this method to set the layout to use in your Tile.
getTileState
suspend fun <T : Any?>getTileState(): T
Retrieve the state of the wear tile provided by this service
onStart
open funonStart(intent: Intent?, startId: Int): Unit
updateTileState
suspend fun <T : Any?>updateTileState(updateState: suspend (T) -> T): T
Update the state of the wear tile provided by this service
Protected functions
onResourcesRequest
protected final funonResourcesRequest(requestParams: RequestBuilders.ResourcesRequest): ListenableFuture<ResourceBuilders.Resources>
Called by the system to fetch a resources bundle from this GlanceTileService.
Note that this call exists due to this class extending TileService; this should not be called directly.
onTileRemoveEvent
@CallSuper
protected open funonTileRemoveEvent(requestParams: EventBuilders.TileRemoveEvent): Unit
Called when a tile provided by this Tile Provider is removed from the carousel.
Note that this is called from your app's main thread, which is usually also the UI thread.
| Parameters | |
|---|---|
requestParams: EventBuilders.TileRemoveEvent |
Parameters about the request. See |
onTileRequest
protected final funonTileRequest(requestParams: RequestBuilders.TileRequest): ListenableFuture<TileBuilders.Tile>
Called by the system to fetch a tile from this GlanceTileService.
Note that this call exists due to this class extending TileService; this should not be called directly.
Public properties
stateDefinition
open val stateDefinition: GlanceStateDefinition<*>?
Data store for tile data specific to this service
timelineMode
open val timelineMode: TimelineMode
Defines the handling of timeline