Quick question. Does androidx.wear.tiles.tiles:1.4...
# compose-wear
a
Quick question. Does androidx.wear.tiles.tiles:1.4.1 support a way to create multiple instances of the same tile? (Clicking on tile from tile chooser adds instance to the tile carousel, similar to watch faces) If so, is there some documentation for this?
y
I'm not aware of any official documented approach. And I don't think there is any approach that would work across OEM and versions. But HomeAssistant for example tries to set this. https://github.com/home-assistant/android/blob/master/wear/src/main/AndroidManifest.xml#L204
Copy code
<meta-data
                android:name="com.google.android.clockwork.tiles.MULTI_INSTANCES_SUPPORTED"
                android:value="true" /> <!-- This is supported starting from Wear OS 3 -->
a
@yschimke There's an app called Qhabit which accomplishes it at least on Galaxy Watches and Pixel Watches (Wear OS 4 / Wear OS 5). It's definitely only one TileService. I'll try to contact the dev. Do you think it may use same meta-data tag in Manifest?
y
I'm not sure. But the API is setup so it's possible to identify which tile any request is for.
And this could stop working as it's not a published API
Try running home assistant?
a
I tried with my own apps service & meta-data tag. It didn't work on Pixel Watch 3. Strange.. I'll try Home Assistant and let you know.
@yschimke offtopic. Do you think it's possible to create, update and use AppDataKey from protolayout.expressions in DynamicComplicationText ? https://developer.android.com/training/wearables/tiles/dynamic For example, let's use
KEY_WATER_INTAKE = AppDataKey<DynamicInt32>("water_intake")
Then in DynamicComplicationText
DynamicBuilders.DynamicInt32().from(KEY_WATER_INTAKE)
If possible, then how to update key with newer values and pass state to complication? State.Builder does not seem to help, or DynamicComplicationText is not able to take values from own AppDataKey. My complication always uses DynamicInvalidationFallback as if data source was not available (key) Any thoughts?
y
An Apps AppDataKey are only available in Tiles.
plus green 1
a
@yschimke so apparently both meta-data tags are needed, MULTI_INSTANCES_SUPPORTED and PROVIDER_CONFIG_ACTION. Without PROVIDER_CONFIG_ACTION multiple instances are not working:
Copy code
<!-- Tile Multi Instances Support - this is supported starting from Wear OS 3 -->
<meta-data
    android:name="com.google.android.clockwork.tiles.MULTI_INSTANCES_SUPPORTED"
    android:value="true" />
<meta-data
    android:name="com.google.android.clockwork.tiles.PROVIDER_CONFIG_ACTION"
    android:value="ConfigFavoriteAppsTile" />
I hope this will be later published API as it's very helpful.
❤️ 1
y
Thanks for updating here.