Notifications
You can enable notifications in DiyalogSDK. It uses Firebase services for app that deployed to Google App store and Huawei Mobile Services for app that deployed Huawei App Gallery.
#
Firebase Cloud Messaging integrationIn Diyalog SDK we have used firebase messaging platform for sending push notification. so we have used firebase services in sdk. Client need to configure as below into main application.
For application that deployed to Google App Store :
*version-no should be the current stable version of Diyalog Android SDK.
#
To create a Firebase projectNeed to do configure below Steps on firebase console
Step 1: Create a Firebase project in the Firebase console, if you don't have any project then Click Add project. If you already have an existing Google project associated with your mobile app, select it from the Project name drop down menu. Otherwise, enter a project name to create a new project
Step 2: Follow the remaining steps and click Create project (or Add Firebase if you have existing project) for your project. When the process completes, you'll be taken to the project overview.
#
Now that you have a project, you can add your Android app to itStep 1: Click Add Firebase to your Android app and follow the setup steps. If you're importing an existing Google project, this may happen automatically and you can just download the config file.
Step 2: When prompted, enter your app's package name. It's important to enter the package name your app is using; this can only be set when you add an app to your Firebase project.
Step 3: During the process, you'll download a google-services.json file. You can download this file again at any time.
Step 4: After you add the initialization code, run your app to send verification to the Firebase console that you've successfully installed Firebase.
#
Configuration Steps for android projectClient need to perform a few basic steps to prepare your Android Studio project.
Step 1: Add google-services.json file to application level project. (usually the app/google-services.json)
Step 2: Add rules to your root-level build.gradle file, to include the google-services plugin and the Google's Maven repository.
Step 3: Then, in your module Gradle file (usually the app/build.gradle), add the apply plugin line at the bottom of the file to enable the Gradle plugin. You should also add the dependencies for the Firebase SDKs.
Step 4: Now, client require to Pass sender ID/project ID to sdk from main application as below. client need to pass this pushID before Initialize() sdk. Client can register pushID into application class.
Done. Above steps are enough for generating push notification, if main application has no any FCM integration. If you are usinf fcm in your app, you should follow next section to integrate to DiyalogSDK.
#
Main application has firebase push notificationIf in main application has also firebase push notification then client need to follow additinal below steps to configure FCM push notification.
Step 1: Client need send device token to diyalog sdk from main application's FirebaseMessagingService class.
Step 2: Client need to pass push payload data(RemoteMessage) to diyalog sdk from application's FirebaseMessagingService.
Step 3: Open your project AndroidManifest.xml file and register firebase service as below line of code inside application tag.
#
Huawei Mobile Services pushkit integrationIn Diyalog SDK we have used Huawei Mobile Services platform for sending push notification to Huawei devices that installs application from App Gallery. Client need to configure as below into main application.
For application that deployed to Huawei App Gallery :
*version-no should be the current stable version of Diyalog Android SDK.
#
To create a Huawei Mobile Services PushKit projectNeed to do configure below Steps on HSM console
Step 1: Create an account and your project in Huawei Mobile Services platform.
Step 2: Create your project in AppGallery connect. Enable pushkit api for your project.
Step 3: During the process, you'll download a agconnect-services.json file. You can download this file again at any time.
#
Configuration Steps for android projectClient need to perform a few basic steps to prepare your Android Studio project.
Step 1: Add agconnect-services.json file to application level project. (usually the app/agconnect-services.json)
Step 2: Add rules to your root-level build.gradle file, to include the huawei-services plugin from Huawei maven repository.
Step 3: Then, in your module Gradle file (usually the app/build.gradle), add the apply plugin line at the bottom of the file to enable the Gradle plugin. You should also add the dependencies for the Huawei SDKs.
Step 4: Now, client require to Pass sender ID/project ID to sdk from main application as below. client need to pass this pushID before Initialize() sdk. Client can register pushID into application class.
Done. Above steps are enough for generating push notification, if main application has no any FCM integration. If you are using HMS in your app, you should follow next section to integrate to DiyalogSDK.
#
Main application has Huawei Mobile Services pushkitIf in main application has also HMS push notification then client need to follow additinal below steps to configure HSM pushkit.
Step 1: Client need send device token to diyalog sdk from main application's HmsMessageService class.
Step 2: Client need to pass push payload data(RemoteMessage) to diyalog sdk from application's HmsMessageService.
Step 3: Open your project AndroidManifest.xml file and register firebase service as below line of code inside application tag.
Done :)