Enabling Huawei Push Notifications for Registered Apps

This article covers the process of enabling Huawei push notifications for an app that is already registered with the edna Platform. Such apps have the Connected status that you can see in the push channel window. If you have not registered the app yet, refer to this article for the process of enabling Huawei push notifications for a new app.

You enable Huawei push notifications for a registered push channel on the Channels page.

Before you continue with the setup, verify that you have the following:

An Android app with minSdk no earlier than 21 (Android 5) and targetSdk no later than 31 (Android 12)
The Huawei App ID and Huawei App Secret parameters from Huawei AppGallery
The agconnect-services.json file from Huawei AppGallery
A current version of Android Studio

1. Enter App Data from Huawei

  1. On the Settings > Channels page in the edna Platform, select the push channel for which you want to enable Huawei Cloud and click Edit.
  2. Scroll down and click Connect in the Huawei App section.
  3. In the respective fields, enter the Huawei App ID and Huawei App Secret parameters obtained from Huawei AppGallery. If you haven’t registered the app in Huawei AppGallery, refer to this article.

  4. Click Connect.

2. Update Dependencies in build.gradle File

  1. Update dependencies in the project’s build.gradle file — add Huawei services to the list of the dependencies.
  buildscript {  
    repositories {
        //...
        maven { url 'http://developer.huawei.com/repo/' }
    }
      //...
    dependencies {
        //...
        classpath "com.google.gms:google-services:4.3.10"
        classpath "com.huawei.agconnect:agcp:1.6.0.300"
    }
    //...
  allprojects {
    repositories {
       //...
        maven { url 'https://maven-pub.edna.ru/repository/maven-public'}
        maven { url 'http://developer.huawei.com/repo/' }
    }
}
  1. To the build.gradle file of the app, apply the plugin and add edna libraries to the list of dependencies.
      apply plugin: 'com.huawei.agconnect'

      dependencies {
         //...
         implementation "com.edna.android:push-x:1.2.2"
         implementation "com.edna.android:push-x-huawei:1.2.2"
      }
  1. Add the following rules to the proguard-rules.pro file:
    
    -keep class com.edna.android.push_lite.**{*;}
    -keep class com.hianalytics.android.**{*;}
    -keep class com.huawei.updatesdk.**{*;}
    -keep class com.huawei.hms.**{*;}
  1. To the root folder of your app, add the agconnect-services.json file you obtained in Huawei AppGallery.

All done! You can now send push notifications to your app via Huawei Cloud.

Enabling Huawei Push Notifications for New Apps