संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
TileService एक बाउंड सेवा है. आपका TileService, आपके ऐप्लिकेशन के अनुरोध के नतीजे के तौर पर या सिस्टम को उससे संपर्क करने की ज़रूरत पड़ने पर बाउंड होता है. आम तौर पर, बाउंड-सेवा के लाइफ़साइकल में ये चार कॉलबैक तरीके होते हैं: onCreate(), onBind(), onUnbind(), और onDestroy().
जब भी सेवा, लाइफ़साइकल के किसी नए चरण में प्रवेश करती है, तब सिस्टम इन तरीकों को लागू करता है.
हालांकि, TileService ज़्यादातर अन्य बाउंड सेवाओं से अलग है, क्योंकि इसमें TileService के लाइफ़साइकल के हिसाब से तरीके भी शामिल होते हैं. Service लाइफ़साइकल के तरीकों और TileService लाइफ़साइकल के तरीकों को, दो अलग-अलग असाइनोक्रोनस थ्रेड में कॉल किया जाता है.
इन तरीकों और इवेंट के बारे में ज़्यादा जानकारी के लिए, TileService दस्तावेज़ देखें.
यह क्वेरी करना कि कौनसी टाइल चालू हैं
ऐक्टिव टाइल, ऐसी टाइल होती हैं जिन्हें स्मार्टवॉच पर दिखाने के लिए जोड़ा गया है. TileService के स्टैटिक तरीके getActiveTilesAsync() का इस्तेमाल करके, यह पता लगाएं कि आपके ऐप्लिकेशन से जुड़ी कौनसी टाइल चालू हैं.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 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."]]