Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
TileService bir bağlama hizmetidir. TileService, uygulama isteğiniz sonucunda veya sistemin onunla iletişim kurması gerektiğinde bağlanır. Tipik bir bağlı hizmet yaşam döngüsü aşağıdaki dört geri çağırma yöntemini içerir: onCreate(), onBind(), onUnbind() ve onDestroy().
Sistem, hizmet yeni bir yaşam döngüsü aşamasına her girdiğinde bu yöntemleri çağırır.
Ancak TileService, TileService'ye özgü yaşam döngüsü yöntemleri de içerdiği için diğer bağlı hizmetlerin çoğundan farklıdır. Service yaşam döngüsü yöntemleri ve TileService yaşam döngüsü yöntemleri iki ayrı asenkron iş parçacığında çağrılır.
Bu yöntemler ve etkinlikler hakkında daha fazla bilgi için TileService dokümanlarına bakın.
Hangi karoların etkin olduğunu sorgulayın
Etkin kartlar, kol saatinde gösterilmek üzere eklenen kartlardır. Uygulamanıza ait hangi karoların etkin olduğunu sorgulamak için TileService'ın statik yöntemi getActiveTilesAsync()'i kullanın.
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-27 UTC.
[null,null,["Son güncelleme tarihi: 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."]]