TileService
is a bound service. Your TileService
is bound as a result
of your app request or if the system needs to communicate with it. A typical
bound-service lifecycle contains the following four callback methods:
onCreate()
, onBind()
, onUnbind()
, and onDestroy()
.
The system invokes these methods each time the service enters a new lifecycle
phase.
However, TileService
differs from most other bound services because it also
contains TileService
-specific lifecycle methods. The Service
lifecycle
methods and the TileService
lifecycle methods are called in two separate
asynchronous threads.
There are two categories of TileService
methods:
- Methods relating to core Tile functionality.
onTileRequest()
(mandatory to implement) andonTileResourcesRequest()
are in this category. - Methods relating to analytics and visibility. This includes methods such
as:
onTileAddEvent()
called when when the user adds your tile to the carouselonTileRemoveEvent()
called when the user removes your tile from the carouselonRecentInteractionEventsAsync()
provides information about recent user and system interactions with tiles
See the TileService
documentation for more information about these
methods and events.
Query which tiles are active
Active tiles are tiles which have been added for display on the watch. Use
TileService
's static method getActiveTilesAsync()
to query which tiles
belonging to your app are active.