A quick question unrelated to compose, but regardi...
# compose-wear
y
A quick question unrelated to compose, but regarding migration to androidx. Is there a guidance of how to migrate
com.google.android.support:wearable
to the
androidx.wear
libs? There is a mapping for the
android.support.wear
lib (https://developer.android.com/jetpack/androidx/migrate/class-mappings), but I haven’t found one for
com.google.android.support:wearable
sofar, which contains Watchface, Complication and so on, the kotlin one might be https://developer.android.com/jetpack/androidx/releases/wear-watchface, and it feels almost impossible to just switch the libs, but more like to rewrite everything new. I would really appreciate any hints of how to do that gradually, instead of a big bang.
l
Hello, it looks like migration hasn't been provided. I personally had a 6 year old watch face project, and I redid it with the new APIs. Doable, and you don't necessarily need to throw everything away, but you do need to check how the new APIs work (and doc for that could be improved IMHO). Anyway, if you need help migrating, feel free to reach ask any questions, I can probably help.
j
@Garan Jenkin
g
Hi @Yingding Wang - you're right there isn't a simple mapping and you'll need to rewrite using the new APIs for watch face etc. One natural split might be to do watch faces and complication data sources separately? Whilst there isn't a guide to migrating, please do raise any gaps in the documentation for the androidx libraries so that we can address this and make the process smoother for you?
y
@Garan Jenkin A quick feedback on the following 3 pain points in terms of Doc Improvement, while I am rewriting using the new APIs with a split on watchfaces and complication data sources. 1. I wasn’t able to use
com.google.android.support:wearable
and
androidx.wear.watchface:watchface-complications-data-source-ktx
in the same module due to
Duplicate class android.support.wearable.complications
im both libs even with gradle exclusion
Copy code
implementation ("androidx.wear.watchface:watchface-complications-data-source-ktx:1.1.0") {
        exclude group: "android.support.wearable", module: "complications"
    }
My plan was to rewrite the complication with
ComplicationDataSourceSerivce
first, the new complication seems to run on the old java watchface with only an icon issue. I really appreciate a doc on how to do this, so that I can split the development 2. I will also welcome a new codelab of how to make Kotlin WatchFace with the new
androidx
api, the current kotlin watchface example from wear-os-sample uses
Renderer.CanvasRenderer
is deprecated (https://github.com/android/wear-os-samples/blob/main/WatchFaceKotlin/app/src/main/[…]com/example/android/wearable/alpha/AnalogWatchCanvasRenderer.kt). I haven’t found any docs and examples on
Renderer.CanvasRenderer2
with
Renderer.SharedAssets
yet. How can I do that? 3. From The new Wear OS Dev Page (https://developer.android.com/wear), the “*Featured resources*” section still has the “create a Complication” link pointing to the deprecated
ComplicationProviderService
site (https://developer.android.com/training/wearables/tiles/exposing-data-complications), which seems to have an PendingIntent Vulnerability issue due to the play store.