Coding Assistant — Automatic Environment Configuration of Push Kit in One Click
Introduction
Coding Assistant provides HMS Core APIs and sample code. We only need to drag and drop scenario cards to integrate the corresponding scenarios. Here we can simply configure the Push Kit integration environment with one click, and the tool will automatically complete the configuration.
HMS Core Tool Kit Introduction:
HMS Core Tool Kit is a plug-in Installed in Android studio to facilitate app creation, coding, conversion, debugging, testing and release. It helps to integrate HMS Core API in the most efficient way and at the lowest possible cost.
To know more about HMS tool Kit and installation process use the Link.
Integrating Procedure
Previously we may have needed to set many configuration items while integrating push Kit and have to check them repeatedly to avoid omission. To address this issue Huawei sorted the integration process and placed the configuration items into an automatic process. This is called the automatic environment configuration in one click mode.
So, click Start Configuration to initiate an automatic check whether configuration is required for integration to be completed. If not, some will automatically be completed while the rest will have to be processed as prompted. Click Retry to check whether all of the configuration items are completed. This ensures that the entire configuration process is clear and there are no omissions.
Development Based on Scenarios and Steps
Huawei provides scenario-based and step-based development modes.
- For scenario-based development, drag a scenario card to a project to automatically insert related code, configurations, and dependencies.
- For step-based development, access a card to view the detailed steps and API code snippets of a scenario, and copy code snippets to a project.
Here we are using scenario-based development.
Steps for Integrating Push Kit Via Coding Assistant
- Go to HMS > Coding Assistant
2. Login Via opened browser
3. Provide access permission
After log in, it will be redirected to HUAWEI Dev Eco Studio home Page.
Configuration Wizard
Configuration Wizard will help us to quickly complete the necessary preparations such as registering an app and generating a signing certificate fingerprint so that we do not spend more time.
- To setup development environment, click Configuration.
2. In Configuration Wizard, select Choose your team name, Choose kit, Choose your module and Certificate to generate the fingerprint.
Click Start Environment Check, as follows.
3. Click Go to environment configuration, as show in below image.
Note: To solve the issues in Environment Check as App Gallery Connect cannot locate your application, Data storage location has not been set yet etc.
4. Configuration Results will show details of failed steps. Go to each and every failed steps and click the corresponding Link.
5. Click Link, it will redirect to AppGallery.
Note: Here the first issue is there is no application in AppGallery with the same package name as the application created in Android Studio. So in AppGallery we have to create an application with the same package name. We can check Event Log and can verify which steps are executed successfully.
6. Create New project.
7. Click Add app in General Information for creating app
8. Enter App name, Package name, App category and Default language.
9. In Configuration Result, click Retry, it will provide new result and prompt to set data storage location.
10. After click on Link, it redirect to AppGallaery Conect and we need to set Data Storage Location.
11. Select Data Storage location.
12. In Configuration Result, click Retry, it will provide new Configuration Results.
It prompts to enable service manually.
13. In AppGallery Connect, click Enable now Huawei PushKit.
14. In Configuration Result, click Retry, it will provide new Configuration Results. It prompts to enable API.
15. In AppGallery Connect, Enable Push Kit API as shown below.
16. In Configuration Result, click Retry. Finally it will provide success message.
Note: Check Event Log and see the details.
17. In Configuration Results click Go to Coding Assistant.
Scenario Integration
- To integrate a scenario, find the scenario card in the scenario list and drag and drop the card to the code editing area.
2. Select the select implement method option.
3. It will create a subclass of the message service and set up automatic initialization. When the application starts, the message service is automatically started
When you drag-to-drop the scenario card, Toolkit automatically generates an Activity file and XML layout file, and writes the configurations and dependencies required for project running to the AndroidManifest file, project-level build.gradle file, and module-level build.gradle file.
Message Test For Push Kit
The message test for Push Kit is also integrated into Tool Kit which ensures you can test the messaging functions in Android Studio.
- Select Message Type. Add Message title and Message Content. APP ID, APP SECRET and token will generate automatically.
2. Click send button to get Push notification message
Conclusion
Coding Assistant helps to integrate HMS Kit easily without normal manual configuration process. The Scenario list helps to add the codes in drag and drop, cloud debugging helps to test remote real devices and message test helps the developer to save their time in testing process. Overall, Coding Assistant helps us to make a giant leap towards HMS kit integration.