Glance

Build layouts for remote surfaces using a Jetpack Compose-style API.
Latest Update Stable Release Release Candidate Beta Release Alpha Release
February 23, 2022 - - - 1.0.0-alpha03

Declaring dependencies

To add a dependency on Glance, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

Groovy

dependencies {
    // For AppWidgets support
    implementation "androidx.glance:glance-appwidget:1.0.0-alpha03"

    // For Wear-Tiles support
    implementation "androidx.glance:glance-wear-tiles:1.0.0-alpha03"
}

android {
    buildFeatures {
        compose true
    }

    composeOptions {
        kotlinCompilerExtensionVersion = "1.1.0-beta03"
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }
}

Kotlin

dependencies {
    // For AppWidgets support
    implementation("androidx.glance:glance-appwidget:1.0.0-alpha03")

    // For Wear-Tiles support
    implementation("androidx.glance:glance-wear-tiles:1.0.0-alpha03")
}

android {
    buildFeatures {
        compose = true
    }

    composeOptions {
        kotlinCompilerExtensionVersion = "1.1.0-beta03"
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }
}

For more information about dependencies, see Add build dependencies.

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Version 1.0.0

Version 1.0.0-alpha03

February 23, 2022

androidx.glance:glance-*:1.0.0-alpha03 is released. Version 1.0.0-alpha03 contains these commits.

New Features

  • Simplified state definition to default to Preferences.

API Changes

  • Simplify state handling by make PreferencesGlanceStateDefinition the default state handling. Removed GlanceAppWidget.updateAppWidgetState and introduced updateAppWidgetState that uses Preferences by default. (I58963)
  • Add Glance TemplateText class and update Template design (I4e146)
  • Adds outline infrastructure for the Freeform template (If03d6)
  • Updates to SingleEntityTemplate layouts (If925d)
  • Added LazyVerticalGrid (I5f442)
  • Use ColorProvider on SingleEntityTemplate (I01ee0)
  • Update template class name (I3720e)
  • Added LinearProgressIndicator and CircularProgressIndicator composable. (Ie116b)

Bug Fixes

  • Initial glance templates implementation, defines "single item template" data and example template layout (I35837)
  • Align the tile cotent to center by default (I264be)
  • Bug fix with fillMaxSize/Width/Height in glance-wear-tiles (I0a39f)

Version 1.0.0-alpha02

January 26, 2022

androidx.glance:glance-*:1.0.0-alpha02 is released. Version 1.0.0-alpha02 contains these commits.

New Features

This release contains the set of APIs to build Wear Tiles using Compose runtime with composables optimized for "Glanceable"

  • Declare your wear tile service by extending GlanceTileService, a service to create your tile in the composable Content() function.
  • Wear tiles specific glance composables: CurvedRow, CurvedText.
  • Handle different timeline modes for tile by defining TimelineMode.SingleEntry and TimelineMode.TimeBoundEntries.
  • LocalTimeInterval, the Local composition refer to a specific time interval.
  • BorderModifer is a GlanceModifier applying a border around an element.

This release also adds Progress Indicators to AppWidget Glance.

API Changes

  • Added LinearProgressIndicator and CircularProgressIndicator composable. (Ie116b)
  • Change actionStartBroadcastReceiver to actionSendBroadcast (I7d555)
  • Pass Context to GlanceAppWidget onDelete callback (I4c795)

Bug Fixes

  • Correct handling of OPTIONS_APPWIDGET_SIZES if present but empty. (I01f82)

Version 1.0.0-alpha01

December 15, 2021

androidx.glance:glance:1.0.0-alpha01, androidx.glance:glance-appwidget:1.0.0-alpha01, and androidx.glance:glance-appwidget-proto:1.0.0-alpha01 are released. Version 1.0.0-alpha01 contains these commits.

Features in initial release

  • The first release of Glance includes the first set of APIs to build AppWidget using Compose Runtime with a set of new Composables optimized for “Glanceables”.

Features