Skip to content

Tiles Library

CoroutinesTileService

Provides a CoroutinesTileService, which also acts as a LifecycleService.

class ExampleTileService : CoroutinesTileService() {
    override suspend fun tileRequest(requestParams: RequestBuilders.TileRequest): Tile {
        return Tile.Builder()
            // create your tile here
            .build()
    }

    override suspend fun resourcesRequest(
        requestParams: RequestBuilders.ResourcesRequest
    ): ResourceBuilders.Resources = ResourceBuilders.Resources.Builder().setVersion("1").build()
}

Coil Image Helpers

Provides a suspending method to load an image from the network, convert to an RGB_565 bitmap, and encode as a Tiles InlineImageResource.

val imageResource = imageLoader.loadImageResource(applicationContext, 
    "https://raw.githubusercontent.com/google/horologist/main/docs/media-ui/playerscreen.png") {
    // Show a local error image if missing
    error(R.drawable.missingImage)
}

Download

repositories {
    mavenCentral()
}

dependencies {
    implementation "com.google.android.horologist:horologist-tiles:<version>"
}