Read the original article:Single and Dual Frame WearEngine Development Guide
Problem Description
The user needs to send messages or files between the wearable device app and the smartphone app. What SDK should be used?
Background Knowledge
Wear Engine in HarmonyOS enables communication between a smartwatch and a companion device like a smartphone. It allows data syncing, message exchange, and control actions between the two devices.
Solution
Applying for Wear Engine permission on mobile phones
For Lite / Smart wearables: Applying for the Wear Engine Service
For HarmonyOS wearables: Applying for Integrating Wear Engine
Mobile App Development For Android
For Android apps: Android Mobile App Development Preparations
Currently, only watches released after SOLO, such as SOLO, LUCA, and VJ, support the WearEngine on iOS phones. However, Huawei Health on iOS phones does not have an app store, so apps cannot be installed on the sports watch. Currently, only pre-installed apps can use iOS Wear Engine for sports watches.
- Check whether the user has an available wearable device: Querying Available Wearable Devices
- Request user authorization for permissions: Requesting User Authorization
- Obtain connected devices: Obtaining Wearable Devices That Support App-to-App Message Communications
- Start the app on the wearable device: Checking Whether the Wearable App is Running
- Send message: Sending P2P Messages
- Send file: Sending Files
- Receiving message or file from the wearable: Receiving P2P messages or files sent by your wearable app Receiving P2P messages or files sent by your wearable app
Mobile App Development For HarmonyOS
- Obtain connected devices: Querying Connected Wearable Devices
- Request user authorization for permissions: Requesting User Authorization
- Start the app on the wearable device: Launching the Device-side App with the Phone-side App
- Send message: Sending P2P Messages
- Send file: Sending Files
- Receiving message from the wearable: Subscribing to and Receiving Messages Sent by the Wearable App
- Receiving file from the wearable: Subscribing to and Receiving Files Sent by the Wearable App
Wearable App Development for Smart & Lite wearables
- Integrate the SDK: JS - Integrating the Wear Engine SDK - Java - Integrating the Wear Engine SDK
- Check for phone app: JS - Checking Whether Your App Has Been Installed on the Phone - Java - Checking Whether Your App Has Been Installed on the Phone
- Send message: JS - Sending P2P Messages - Java - Sending P2P Messages
- Send file: JS - Sending Files - Java - Sending Files
- Receive message or file from mobile app: JS - Receiving P2P Messages or Files from Your Phone App - Java - Receiving P2P Messages or Files from Your Phone App
- Obtaining mobile device system information: JS - Obtaining the System Information of a Mobile Phone - Java - Obtaining the System Information of a Mobile Phone
Wearable App Development for HarmonyOS wearables
- Wearable-based HarmonyOS app development is only applicable to HarmonyOS 4 and earlier versions. For details, refer to Wearable App Development.
Verification Result
Tested on Watch 3, GT4, and GT5. Confirmed to be working.
Top comments (0)