Integrating Huawei Rest API by Remote Configuration in HarmonyOS
In this article, we will learn how to integrate Huawei Rest API by Remote Configuration in HarmonyOS. It allows users to quickly get the token, query versions information’s and update the versions and rollback versions, it does not required any app updates to take effect. This makes developer and app users more convenient and experience version changes or experience app configuration or behavior changes for your users in a timely manner.
Development Overview
You need to install latest DevEcho studio IDE and I assume that you have prior knowledge about the Harmony OS and java.
Hardware Requirements
- A computer (desktop or laptop) running Windows 10.
- A Harmony OS phone (with the USB cable), which is used for debugging.
Software Requirements
- Java JDK installation package.
- Latest DevEcho studio installed.
Follow Steps:
Step 1: Create HarmonyOS Application
Step 2: Create project in AppGallery and configuration
Step 3: Add below dependencies in build.gradle and sync
Step 4: Add below permissions in config.json
Let’s start coding
How do I initialize retrofit?
How do I get Token?
How do I get All Versions?
How do I call Rollback API?
Result
Tips and Tricks
- Add required images in resources > base > media.
- Add icons or required images in resources > base > graphic.
- Add custom strings in resources > base > element > string.json.
- Define supporting devices in config.json file.
- Makes sure the Remote configuration service is enabled in AppGallery.
- Makes sure that permissions are added in config.json.
- Make sure domain and country name selected in agc are same.
Conclusion
In this article, we learnt how to integrate Huawei Rest API by Remote Configuration service in HarmonyOS. In this sample I have shown how to fetch Token, get all versions list, and update version and rollback API. Similarly Remote Configuration service can be used in your application as per your requirement. Hope this article helps you to understand Huawei Rest API by Remote Configuration service in HarmonyOS.
Thank you so much for reading this article and please provide your valuable feedback and like.
Reference