This demo project shows how to implement a Huawei wearable app to show current live scores of various sport matches. The project consists of an Android and HarmonyOS app (Wearable app).
The Android app is responsible to make the API call and transfer the result via Huawei Wearengine to wearable app. The project is written in Kotlin and Jetpack Compose. The main mechanic is to start a Foreground Service which maintains the Wearengine connection between phone and watch, whenever the watch app is requesting data, the Foreground Service fetches the data through API and transfer a JSON to watch.
The HarmonyOS app is responsible of displaying the live score data which is received from the Android app in a list UI element. Various wearable device models are supported in the project, each device model code is encapsulated in a own Gradle module. All code are written in Javascript, HML and CSS.
- Huawei Sportwatch (Litewearable)
- Watch GT2 Pro
- Watch GT Runner
- Watch GT3 and GT3 Pro
- Watch Fit2
- Huawei Smartwatch (Smartwearable)
- Watch3
Use Gradle module gt2 for GT2 Pro
Use Gradle module gt3 for GT Runner, GT3, GT3 Pro
Use Gradle module yoda for Fit2
Use Gradle module watch3 for Watch3
GT2Pro | GT Runner | GT3 | GT3Pro | Fit2 |
---|---|---|---|---|
Watch3 |
---|
Get the latest Android Studio version to build the Android project.
RapidAPI (Basic is free) is used for live score data, register here to obtain an API key and configure it in
local.properties
with API_KEY=xxxxxx
.
Get the latest DevEco Studio version to build the HarmonyOS project. Apply for wearengine in Huawei Developer Console, configure signing and bundle name of HarmonyOS project. Refer to official documentation for details how to do it.
Be aware I created a convenient script for fast deployment of different litewearable modules at same time.
Icons in the app are taken from flaticon.