How to Integrate HUAWEI Push Plugin to Outsystems

Mesutgedikk
6 min readJul 5, 2021

Introduction

Hello everyone, I will show how to integrate Huawei Push Plugin to an Outsystems project in this article.

OutSystems is a modern application platform designed to dramatically accelerate the development of your most critical applications while also delivering unprecedented levels of flexibility and efficiency. Address your top digital transformation priorities with applications that make a difference across all areas of the business — from customer experience transformation and workplace innovation to process automation and application modernization.

Prerequisites

You should install Outsystems Service Studio on your PC. And create an account from Outsystems Sign In page.

Configuring App Information in AppGallery Connect

Before you get started, you must register as a HUAWEI developer and complete identity verification on HUAWEI Developers.

Firstly, let’s create an AppGallery Connect Project.

  1. Sign in to AppGallery Connect and select My projects.
  2. Click Add project.

3. Enter a project name and click OK.

After the project is created, the Project settings page is displayed. Before you use the development capabilities provided by AppGallery Connect, you need to add an app to your project first.

  1. In section Project settings > General information, click Add app.
  2. On the Add app page, enter app information.

Enter App Information

3. On the Project settings page, enter SHA-256 certificate fingerprint and then download the configuration file agconnect-services.json for the Android platform.

A signing certificate fingerprint is used to verify the authenticity of an app when it attempts to access an HMS Core (APK) through the HMS SDK. Before using the HMS Core (APK), you must locally generate a signing certificate fingerprint and configure it in the AppGallery Connect. You can refer to 3rd and 4th steps of Generating a Signing Certificate Codelab tutorial for the certificate generation. Perform the following steps after you have generated the certificate.

Enabling Service

To use HUAWEI Push Service on your app, you first need to enable the service.

Sign in to AppGallery Connect and click My projects.

Find your project from the project list and click the app for which you need to set Push Kit parameters on the project card.

Go to Project settings > Manage APIs and enable Push Kit.

Go to Grow > Push Kit and click Enable now. In the dialog box that is displayed, click OK.

Pre-installation steps end here. Basically, we created an AppGallery Connect project and enabled the Push Service. We also saved the SHA-256 certificate fingerprint to the project.

Installation

Firstly, open Outsystems Service Studio. Log In to your account which created before.

Create a new application. We are choosing “From scratch” to create an application.

And we are selecting “Phone App”.

We are filling the App Name and Descriptions part. After that, we are clicking to Create Module button and the project will be created.

Now, we must create a screen. So we are clicking the Screen component from the left side and selecting Empty screen.

We created a screen. Now, we must install HUAWEI Push Plugin from Forge. Click the Forge tab from the top left of the Outsystems Service Studio. And search for “HMS Push Plugin”, click it then install it.

When installation finished, go back to the demo project. Click the Module tab and click to Manage Dependencies ( You can also use the Ctrl+Q shortcut ). Search HMSPushPlugin and enable it.

In the application, navigate to Data > Resources. Right-click it. Click Import Resource on the popup menu opened. Browse the agconnect-services.json and click Open. Make sure that Deploy Action is set to Deploy to Target Directory.

Now, we can use every method in HUAWEI Push Plugin.

Send Notification to Subscribers from AppGallery Connect

First of all, we need to call the getToken method to obtain a token for the user. Then we need to subscribe user, a topic with subscribe method.

We are creating a button on the screen. And we double click it to add a getToken method. On the opened page, we are clicking the Logic, top right of the page and going to Client Actions > HMSPushPlugin > HMSPush > getToken method. Drop and drag this method to the flowchart. When the method returned a token, it shows on the screen.

After that, we are creating another button on the screen. And we double click it to add a subscribe method. On the opened page, we are clicking again the Logic, top right of the page and going to Client Actions > HMSPushPlugin > HMSPush > subscribe method. Drop and drag this method to the flowchart. And filling the Topic parameter with “weather”.

Now we are getting build on the main screen of the application. Click the Generate Android App. When the generate finished, we are downloading and installing the application on the phone.

When installation finished, we are opening the application and click the getToken button first. Then we are clicking the subscribe button.

When we subscribed to the user a topic, sign in to AppGallery Connect again and open your project. Then go to Grow > Push Kit and click to Add Notification button.

Now we must fill in the content of the notification.

In the Push Scope part, we are selecting Push Scope > Subscriber and we are choosing the condition which we subscribed to before.

When all is done, we are clicking the submit button.

We are clicking the OK button and sending a notification to everyone who subscribes to the “weather” topic.

As you can see we were able to send the notification on our phones.

Conclusion

In this article, I integrated HMS Push Plugin into an Outsystems and showed the basic functionalities of the Push Kit. I tried to explain the notification sending steps.

Thank you for reading, I hope it was helpful.

References

--

--