GlanceWearWidgetManager

class GlanceWearWidgetManager


Manager for Glance Wear Widgets.

This is used to query the wear widgets currently active on the system.

Summary

Public constructors

Creates a new GlanceWearWidgetManager, providing an interface to check which tiles or widgets are currently present on the system surfaces.

Public functions

suspend List<ActiveWearWidgetHandle>

Returns all currently active widgets instances associated with the calling package.

suspend List<ActiveWearWidgetHandle>

Returns all currently active widgets instances associated with the specified widget class.

Public constructors

GlanceWearWidgetManager

Added in 1.0.0-alpha07
GlanceWearWidgetManager(context: Context)

Creates a new GlanceWearWidgetManager, providing an interface to check which tiles or widgets are currently present on the system surfaces.

This instance is designed for reuse and can be maintained as a singleton within your application.

Parameters
context: Context

The application context.

Public functions

fetchActiveWidgets

suspend fun fetchActiveWidgets(): List<ActiveWearWidgetHandle>

Returns all currently active widgets instances associated with the calling package.

A widget instance is active when it was added by the user to a widget surface.

Legacy Behavior (Pre-API 34): On SDKs prior to Android 14 (U), this method uses a best-effort approach to approximate platform behavior and may be incomplete. Results may omit pre-installed widgets, widgets not visited within the last 60 days, or all widgets if the user has cleared app data. Conversely, widgets removed via an app update may incorrectly persist as "active" for up to 60 days post-removal.

fetchActiveWidgets

suspend fun fetchActiveWidgets(widget: KClass<GlanceWearWidget>): List<ActiveWearWidgetHandle>

Returns all currently active widgets instances associated with the specified widget class.

A widget instance is active when it was added by the user to a widget surface.

Legacy Behavior (Pre-API 34): On SDKs prior to Android 14 (U), this method uses a best-effort approach to approximate platform behavior and may be incomplete. Results may omit pre-installed widgets, widgets not visited within the last 60 days, or all widgets if the user has cleared app data. Conversely, widgets removed via an app update may incorrectly persist as "active" for up to 60 days post-removal.