Case Study – Use cases of HarmonyOS integration in Lite Wearable - Huawei Developers

• How to send message from Android device to watch?
• How to generate the certificates to build the application?
• How to run the application on watch?
Use case 1: How to send message from Android device to watch?
How to send messages and instruction through the smart phone to sports watch.?
Solution:
Use P2P mesaage sending and receiving of wear engine to do the communication. After integrating the wear engine CP was able to send the map related information from smart phone (https://developer.huawei.com/consumer/en/hms/huawei-wearengine)
P2P communication https://developer.huawei.com/consum...ides/smartwatch-send-message-0000001052540469
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Use Case 2: How to generate the certificates to build the application?
In order to run a build on emulator or watch we need to generate .p12,.cer and .p7b certificates. Without adding these things developer cannot run the application.
Solution:
Document has been released with all details.
Document
developer.harmonyos.com
Use Case 3: How to run the application on watch?
To install .hap file on real watch we need to make use of assistant app to install the file. Even udid should be added during the certificate generation.
Solution:
UDID was not added on the console to register the device
Generated UDID was not supporting for Harmony development

Martin Bieber said:
• How to send message from Android device to watch?
• How to generate the certificates to build the application?
• How to run the application on watch?
Use case 1: How to send message from Android device to watch?
How to send messages and instruction through the smart phone to sports watch.?
Solution:
Use P2P mesaage sending and receiving of wear engine to do the communication. After integrating the wear engine CP was able to send the map related information from smart phone (https://developer.huawei.com/consumer/en/hms/huawei-wearengine)
P2P communication https://developer.huawei.com/consum...ides/smartwatch-send-message-0000001052540469
Use Case 2: How to generate the certificates to build the application?
In order to run a build on emulator or watch we need to generate .p12,.cer and .p7b certificates. Without adding these things developer cannot run the application.
Solution:
Document has been released with all details.
Document
developer.harmonyos.com
Use Case 3: How to run the application on watch?
To install .hap file on real watch we need to make use of assistant app to install the file. Even udid should be added during the certificate generation.
Solution:
UDID was not added on the console to register the device
Generated UDID was not supporting for Harmony development
Click to expand...
Click to collapse

Does harmony OS supports TV?

Related

Debug your application on any HMS Supported Model using HMS Toolkit Cloud Debugger

More information like this, you can visit HUAWEI Developer Forum​
Introduction
So you have built a wonderful application but how to test it.
Or do you want to test you application on a specific device.
Let us meet your new friendly developer tool HMS Toolkit. This tool provide us the functionality of Cloud Debugging.
HMS Toolkit Installation:
If you have not yet installed HMS Core Toolkit then please go to below link to download the latest version of it before proceeding further into the article.
https://developer.huawei.com/consumer/en/doc/development/Tools-Library/toolkit-download-0000001050148172
Once downloading is done for the plugin you can directly install it via Install Plugin from disk option.
After installation it should show like below.
By the time of writing this article the latest version was 3.0.1.300.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Let’s Start with Cloud Debugging
Step by step I will guide you on how you can use this tool to test and debug your application without a real Huawei Device.
Step 1: Go to HMS and click Cloud Debugging as shown below.
Cloud debugging needs a user login in order to provide access to real devices. Hence you will be redirected to a URL where you need to confirm your identity for a successful login.
Step 2: Login and allow the service.
Once the service is allowed you will get a success message and your android studio will get access to real remote devices.
Step 3: If this screen is not opened click on cloud debugging in right sidebar.
Filters are available as highlighted below to get a specific device.
You can also check the availability of device by checking Available Devices
Once the list of device is available choose any one and proceed.
Step 4: Below should be the result after filter selection. Click Run and start the device.
A device should appear which can be accessed by sidebar. Default testing time is 2 Hours but if your testing require more time you can choose the same device once again after it gets released automatically.
Step 5: Let us run one application to see how it is performing on Cloud Debugger.
Let us see what all configurable options are given to us with this cloud debugger.
Screen Resolution:
Different resolution for a device are mentioned.
My recommendation – If your internet connection is good then go for higher resolution.
Screen Size:
You can also control screen size between 75%, 100% and 125%. To do that see the below screenshot.
Apart from this all three navigation buttons are provided to you for better control.
Conclusion
I hope you this article had given some insights in cloud Debugging.
In case you face any issue in the installation process do comment.
PS: You can also use this while presenting your screen, it doesn’t consume resources like how android emulator would do.
References
Get Application Insights and start Improving your application in minutes using HMS Toolkit Cloud Testing
HMS Toolkit - Automatic HMS SDK Integration
HMS Toolkit Convertor - Your New Best Friend for Migration
Its very interesting tool but when am trying to connect through cloud debugging am get below error
Request remote service failed: error_code 30002, 暂无可用设备,请稍后再试

Upgrade Invitation from HUAWEI Analytics Kit

To enhance data security, we are planning to implement security hardening on HUAWEI Analytics servers on September 20, 2020. This may affect data logging of some Android apps.
To prevent the said problem, we have released HMS Core Analytics SDK 5.0.1.301 for you to test whether data logging of your app is functioning properly. You are advised to integrate the SDK as soon as possible and conduct a test.
If the test fails, please refer to the following FAQs for the solution:
Debugging problems:
https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/commissioning-faq-0000001050164019
Installation environment problems:
https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/environment-faq-0000001050162062
Performing the Upgrade
Change the SDK version to 5.0.1.301 in the build.grade file of your app.
Code:
implementation 'com.huawei.hms:hianalytics:5.0.1.301'
Testing the Data Logging Result
After upgrading the SDK, enable the debug mode to check whether your app data is logged successfully. The procedure is as follows:
1. Enable the debug mode.
Run the following command to enable the debug mode:
Code:
adb shell setprop debug.huawei.hms.analytics.app package_name
Replace the package_name field in the command with your app package name.
2. Sign in to AppGallery Connect, go to HUAWEI Analytics > Management > App debugging, and check whether data has been logged.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
3. If no data has been logged, resolve the problem by referring to FAQs. If the problem persists, submit a trouble ticket online. We will contact you as soon as possible.
4. Disable the debug mode.
The debug mode remains active after being enabled. If app debugging is no longer needed, run the following command to disable the debug mode:
Code:
adb shell setprop debug.huawei.hms.analytics.app .none.
Thank you for your support for HUAWEI Analytics Kit.
To learn more, feel free to visit our official website at
https://developer.huawei.com/consumer/en/hms/huawei-analyticskit
For more details, you can go to:
Official website
Development Documentation page, to find the documents you need
Reddit to join our developer discussion
GitHub to download demos and sample codes
Stack Overflow to solve any integration problems
My app crashes and the error message "Time out waiting for process to appear on xxx" is displayed in Android Studio. What is the reason?
can we track Realtime data using cloud debugger?

Steps for Integrating the Wi-Fi Sharing Function in Nearby Service

Overview
We've grown accustomed to the hassle of connecting our devices to the Wi-Fi networks in new locations, which can be an annoyance at best, and a major frustration at worst. But perhaps more importantly, this process also comes with the risk of password leakage. Wouldn't it be nice if there was a way to connect our devices to Wi-Fi networks on an automatic basis, rather than having to manually enter the password each time?
HUAWEI Nearby Service offers a Wi-Fi sharing feature, which once integrated, equips your app to connect users on a wide range of smart devices to the Wi-Fi networks that they encounter.
Wi-FiShareDemo
Here, we've used Wi-FiShareDemo as an example, which has integrated the Wi-Fi sharing function in Nearby Service. Now, we'll show you the core code for the app, and how the app can be run.
Preparing Tools
One Huawei phone (The phone for sharing Wi-Fi must be a Huawei phone, and be connected to Wi-Fi.)
One Android device (The device to be connected to Wi-Fi must run Android 5.0 or later and have HMS Core installed, and can be a phone or a TV box.)
Android Studio (3.X or later)
Creating an app
Import the source code to Android Studio.
Register as a Huawei developer.
Create an app in Huawei AppGallery. For details, please refer to HUAWEI Developers-App Development. Note that you will need to download the agconnect-services.json file, generate the signing certificate, and save both to the app directory.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Run the app in Android Studio and install it on the test devices.
Procedures
After configuring the code and completing the installation, perform the following steps.
1.Start Wi-FiShareDemo on B, and tap Connect Wi-Fi.
2.Start Wi-FiShareDemo on A, and tap Share Wi-Fi.
3.On A, select the phone that will share Wi-Fi, make sure that the verification codes on both phones are the same, and tap ALLOW.
4.On B, tap ALLOW in the dialog box that is displayed to authorize the Wi-Fi connection.
Core Code
You can view the source code of the app in GitHub. In this app, the WifiShareHelper.java class is encapsulated based on the Nearby Service APIs. Only the APIs requestWiFiConfig and shareWiFiConfig for WifiShareHelper.java are used to connect to and share Wi-Fi.
requestWiFiConfig
// The device request to connect WiFipublic void requestWiFiConfig() { Log.d(TAG, "requestWiFiConfig"); mWifiShareEngine.startWifiShare(mWifiShareCallback, WifiSharePolicy.POLICY_SET) .addOnFailureListener(e -> Log.e(TAG, Objects.requireNonNull(e.getMessage())));}
shareWiFiConfig
// The device to share wifipublic void shareWiFiConfig() { Log.d(TAG, "Start to share WiFi"); mWifiShareEngine.startWifiShare(mWifiShareCallback, WifiSharePolicy.POLICY_SHARE) .addOnFailureListener(e -> Log.e(TAG, Objects.requireNonNull(e.getMessage()))); showListView(); setListViewListenerMode();}
Learn More
For more details, please visit HUAWEI Developers.
For further instructions, please refer to Development Guides.
To join the developer discussion, please visit Reddit.
To download the demo and sample code, please go to GitHub.
To resolve integration issues, please go to Stack Overflow.

Integrating HUAWEI Game Service Based on Cocos SDKHub - Integrating the App Update Function

After an app is launched, the app update function checks whether there is a later version available on AppGallery. If so, a pop-up is displayed, asking the user whether to update the app.
After you have integrated Cocos SDKHub, the function will use the SDK to check for app updates.
If your joint operations game is rejected for not integrating the app update function, check this post.
Before you integrate the app update function, you need to integrate Cocos SDKHub. (Reference: Integrating HUAWEI Game Service Based on Cocos SDKHub — Integrating Cocos SDKHub)
After that, here’s how you integrate the function:
1.Add the following code by referring to the official document:
JavaScript:
checkUpdate:function(){
var params = {
"showUpdateDialog": "1",
"forceUpdate": "0"
}
console.log("checkAppUpdate button pressed");
sdkhub.getUserPlugin().callFuncWithParam("checkAppUpdate",params);// Call the checkAppUpdate API.
}
2. Associate the code with a specified button and select the checkUpdate method as the tap event.
3. If you see the error information informing you that the callFuncWithParam method is not found during a simulator test, just test the packaged file on a real device.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
4. If the following information is displayed,
the function is integrated.
XML:
D/jswrapper: JS: checkAppUpdate pressed
I/updatesdk: UpdateSDK version is: 2.0.6.302 ,flavor: envrelease ,pkgName: com.cocos2d.xxx
D/HwConnectivityServiceEx: set 10323 wlan0 value false
I/NetworkKit_a: 27569-28056|null|com.huawei.hms.framework.network.grs.a|a|22|get url from sp is not empty.
I/DeviceUtil: UpdateSDK Get url from GRS_SDK Success!https://store1.hispace.hicloud.com/hwmarket/api/
I/StoreTask: UpdateSDK call store responsecode: 200
If the function passes the real-device test, the error displayed in the simulator test may be caused by compatibility failure.
For a mobile game that needs to be forcibly updated, pay attention to:
1. Select Force update when editing information for the new game version in AppGallery Connect.
(See step 8 in the official document)
2. Set forceUpdate in the input parameters to 1.
This way, you have successfully integrated the app update function.
very useful writeup
Neha J said:
very useful writeup
Click to expand...
Click to collapse
Thank you for your liking.

Operations and FAQs of AppGallery Connect Services Demo in Unity

If you haven’t downloaded the demo for integrating Huawei services in Unity, you can access the demo on GitHub.
1. How to fix the invalid dependencies error reported during package resolving in Unity?​Project has invalid dependencies:
com.unity.textmeshpro: connect ETIMEDOUT 172.81.232.209:443
com.unity.timeline: connect ETIMEDOUT 172.81.232.209:443
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
When the preceding dialog box is displayed, click Continue to open the project. Go to Window > Package Manager.
Update each package with an exclamation mark to the latest version to resolve the problem, as shown in the following figure.
2. How to switch the platform to Android?​Go to File > Build Settings. In the Platform area, select Android and click Switch Platform.
3. How to fix the Visual C# compiler version error reported after the platform is switched to Android?​If the following error occurs, close the project and then reopen it to resolve the problem.
Microsoft (R) Visual C# Compiler version 2.9.1.65535 (9d34608e)
Copyright (C) Microsoft Corporation. All rights reserved.
4. How to package and run the demo project?​On the Build Settings page, click Player Settings to display the Project Settings page.
Configure the product name as required.
In Other Settings, set a package name for the Android app, which should be identical to that in the JSON file in AppGallery Connect.
In Publishing Settings, deselect Custom Keystore. (If the services you want to integrate involve app signing, skip this step and perform the necessary operations.)
Download the JSON file from AppGallery Connect and save it to the ..\Assets\Plugins\Android directory of the project.
5. What can I do if error “-Dorg.gradle.jvmargs=-Xmx4096m” “assembleRelease” is reported when I package the demo project?​I have selected a device and clicked Build And Run on the Build Settings page, which reported the following error:
org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
stderr[
Picked up JAVA_TOOLOPTIONS: Dfile.encoding=UTF-8
This problem occurs because the corresponding signature file has been canceled but is still used in the Gradle file.
To resolve this problem, open the launcherTemplate.gradle file in the ..\Assets\Plugins\Android directory, find the following code snippet, and comment it out as shown in the following figure.
6. What can I do if error “launcher-release.apk does not exist” is reported when I package the demo project?​
To resolve this problem, simply select Development Build before packaging the project, as shown in the following figure.

Categories

Resources