Wear Watchface | Android Developers
source link: https://developer.android.com/jetpack/androidx/releases/wear-watchface
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Wear Watchface
Create applications for Wear OS by Google smartwatches.
Latest Update Current Stable Release Next Release Candidate Beta Release Alpha ReleaseOctober 27, 2021
-
-
-
Declaring dependencies
To add a dependency on Wear, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.
Add the dependencies for the artifacts you need in the build.gradle
file for
your app or module:
dependencies {
// Use to implement wear watchfaces
implementation "androidx.wear.watchface:watchface:1.0.0-beta01"
// Use to implement wear watchface complications (Java
implementation "androidx.wear.watchface:watchface-complications-data-source:1.0.0-beta01"
// Kotlin
implementation "androidx.wear.watchface:watchface-complications-data-source-ktx:1.0.0-beta01"
// Use to implement a watchface style and complication editor
implementation "androidx.wear.watchface:watchface-editor:1.0.0-beta01"
}
For more information about dependencies, see Add build dependencies.
Feedback
Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.
See the Issue Tracker documentation for more information.
Version 1.0
Version 1.0.0-beta01
October 27, 2021
androidx.wear.watchface:watchface-*:1.0.0-beta01
is released. Version 1.0.0-beta01 contains these commits.
Version 1.0.0-alpha24
October 13, 2021
androidx.wear.watchface:watchface-*:1.0.0-alpha24
is released. Version 1.0.0-alpha24 contains these commits.
API Changes
- Classes in package
androidx.wear.watchface.complications
have been moved into a newwear:watchface:watchface-complications
project. Note this means you can't include this library as well as any previous alpha version ofwear:watchface:watchface-complications-data
because you'll get errors about duplicate classes. (I97195) - Renderer.dump has been renamed to Renderer.onDump and has been annotated with @UiThread. (I44845)
InteractiveWatchFaceClient.addWatchFaceReadyListener
has been renamed toaddOnWatchFaceReadyListener
andremoveWatchFaceReadyListener
has been renamed toremoveOnWatchFaceReadyListener
. (I48fea)- EditorSession
getComplicationsPreviewData
andgetComplicationsDataSourceInfo
are no longer suspend functions, instead they areStateFlow<>
properties whose value is initially null. In ListenableEditorSessiongetListenableComplicationPreviewData
andgetListenableComplicationsProviderInfo
have been removed in favor of the newStateFlow<>
objects from the base class. If you need to listen to changes in java code, consider usingandroidx.lifecycle.FlowLiveDataConversions.asLiveData
to convert toLiveData<>
. (Ic5483)
Version 1.0.0-alpha23
September 29, 2021
androidx.wear.watchface:watchface-*:1.0.0-alpha23
is released. Version 1.0.0-alpha23 contains these commits.
New Features
The watchface library is now a single library group, and as a result the libraries have moved and you will need to update your gradle imports as follows:
androidx.wear:wear-complications-data
androidx.wear.watchface:watchface-complications-data
androidx.wear:wear-complications-data-source
androidx.wear.watchface:watchface-complications-data-source
androidx.wear:wear-watchface
androidx.wear.watchface:watchface
androidx.wear:wear-watchface-complications-rendering
androidx.wear.watchface:watchface-complications-rendering
androidx.wear:wear-watchface-client
androidx.wear.watchface:watchface-client
androidx.wear:wear-watchface-client-guava
androidx.wear.watchface:watchface-client-guava
androidx.wear:wear-watchface-data
androidx.wear.watchface:watchface-data
androidx.wear:wear-watchface-editor
androidx.wear.watchface:watchface-editor
androidx.wear:wear-watchface-editor-guava
androidx.wear.watchface:watchface-editor-guava
androidx.wear:wear-watchface-guava
androidx.wear.watchface:watchface-guava
androidx.wear:wear-watchface-style
androidx.wear.watchface:watchface-style
API Changes
- Migrate the separate
androidx.wear
Watchface and complications libraries intoandroidx.wear.watchface
library group. (b25f3c0) - Added EditorRequest.canWatchFaceSupportHeadlessEditing to let a client know if a watchface editor supports headless editing. Note there will be some false negatives with this because support was added in asop/1756809 however it will return the correct value for all future watchfaces. (ca55590)
- Renderer now has a dump() method which can be overridden to add custom data to the information generated by ABD shell dumpsys activity service WatchFaceService. (95235f9)
- InteractiveWatchFaceClient.addWatchFaceReadyListener now specifies the executor first. (563ac2f)
- StateFlowCompatHelper has been removed. asLiveData (androidx.lifecycle.asLiveData) should be used instead. (bd35d3)
- CurrentUserStyleRepository.userStyle is no longer mutable. (I44889)
- WatchFaceReadyListener has been renamed to OnWatchFaceReadyListener. (Ic12a9)
Bug Fixes
- InteractiveInstanceManager.deleteInstance to call onDestroy This is needed to ensure InteractiveWatchFaceImpl gets garbage collected.(fce4af8, b/199485839)
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK