--> --> --> -->

How to Enable Push Notifications for Huawei

This article covers the process of enabling Huawei push notifications for an application that is already registered with the edna Pulse. Such applications have the Connected status that you can see in the push channel window.

If you haven’t registered the application yet, follow the instructions on how to enable push notifications for Android.

Make sure you have:

Step 1. Enter App Data from Huawei

  1. On the Settings → Channels page in the edna Pulse, 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, read the article.

  4. Click Connect.

Step 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 platform("com.edna.android:push-x-bom:2.0.0")
         implementation "com.edna.android:push-lite-huawei-release"
      }
  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.