[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-27 UTC"],[],[],null,["# Lifecycle and analytics events\n\n`TileService` is a [bound service](/guide/components/bound-services). Your `TileService` is bound as a result\nof your app request or if the system needs to communicate with it. A typical\n[bound-service lifecycle](/guide/components/bound-services#Lifecycle) contains the following four callback methods:\n[`onCreate()`](/reference/android/app/Service#onCreate()), [`onBind()`](/reference/android/app/Service#onBind(android.content.Intent)), [`onUnbind()`](/reference/android/app/Service#onUnbind(android.content.Intent)), and [`onDestroy()`](/reference/android/app/Service#onDestroy()).\nThe system invokes these methods each time the service enters a new lifecycle\nphase.\n\nHowever, `TileService` differs from most other bound services because it also\ncontains `TileService`-specific lifecycle methods. The `Service` lifecycle\nmethods and the `TileService` lifecycle methods are called in two separate\nasynchronous threads.\n\nThere are two categories of `TileService` methods:\n\n- **Methods relating to core Tile functionality.** [`onTileRequest()`](/reference/androidx/wear/tiles/TileService#onTileRequest(androidx.wear.tiles.RequestBuilders.TileRequest)) (mandatory to implement) and [`onTileResourcesRequest()`](/reference/androidx/wear/tiles/TileService#onTileResourcesRequest(androidx.wear.tiles.RequestBuilders.ResourcesRequest)) are in this category.\n- **Methods relating to analytics and visibility.** This includes methods such as:\n - [`onTileAddEvent()`](/reference/androidx/wear/tiles/TileService#onTileAddEvent(androidx.wear.tiles.EventBuilders.TileAddEvent)) called when when the user adds your tile to the carousel\n - [`onTileRemoveEvent()`](/reference/androidx/wear/tiles/TileService#onTileRemoveEvent(androidx.wear.tiles.EventBuilders.TileRemoveEvent)) called when the user removes your tile from the carousel\n - [`onRecentInteractionEventsAsync()`](/reference/androidx/wear/tiles/TileService#onRecentInteractionEventsAsync(java.util.List%3Candroidx.wear.tiles.EventBuilders.TileInteractionEvent%3E)) provides information about recent user and system interactions with tiles\n\nSee the [`TileService`](/reference/androidx/wear/tiles/TileService) documentation for more information about these\nmethods and events.\n\n### Query which tiles are active\n\n*Active tiles* are tiles which have been added for display on the watch. Use\n`TileService`'s static method [`getActiveTilesAsync()`](/reference/androidx/wear/tiles/TileService#getActiveTilesAsync(android.content.Context,java.util.concurrent.Executor)) to query which tiles\n*belonging to your app* are active.\n| **Caution:** The result reflects the list of active tiles at the time the call was made, which might have changed by the time the result is received. Use `onTileAddEvent()` and `onTileRemoveEvent()` callbacks for scheduling actions that need to happen when your tile becomes either active or inactive."]]