Push Notifications - Android

How to configure Push notifications for Android SDK in Zoho SalesIQ?

​You can send push notifications when the user is not using the android app. In the Zoho SalesIQ console, navigate to Settings > Brands > Installation > Android, scroll down to the Configure push notifications section and enable the toggle button.

How to register my Mobile Device?

Step 1: Get the FCM key from the Google services. A server key that authorizes your app server for access to Google services, including sending messages via Firebase Cloud Messaging. Follow the steps here to set up FCM service. 

Before you proceed with the below steps, check the listed requirements:

  • Created a project in the firebase.
  • Added your app to the created firebase project
  • Override the FirebaseMessagingService class onMessageReceived() method and onNewToken() method.

Step 2: Click the Settings icon in the Firebase console, and navigate to Project Settings > Cloud Messaging, you can find the server key.

Step 3: Enter the server key in the input box.

Step 4: Runtime permissions

From API level 33, it is mandatory to add POST_NOTIFICATIONS permissions in the AndroidManifest.xml file and request runtime permissions to post notifications. For more information, refer to this Android developer document.

Step 5: You should have a class that extends FirebaseMessagingService, which will consume pushes intended for SalesIQ. To allow us to draw the Zoho SalesIQ pushes, you should set up the FirebaseMessagingService as follows:

AndroidManifest.xml

Copied 
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

   <application
        android:icon="@mipmap/ic_launcher">
       ...
        < service
           android:name=".MyFirebaseMessagingService"
           android:exported="false">
           <intent-filter>
               <action android:name="com.google.firebase.MESSAGING_EVENT" />
           </intent-filter>
       </service>
    </application>
</manifest>

MyFirebaseMessagingService.java

Copied 
public class MyFirebaseMessagingService extends FirebaseMessagingService {
    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        Map extras = remoteMessage.getData();
        MobilistenPlugin.handleNotification(this.getApplication(), extras);
    }

    @Override
    public void onNewToken(String token) {
        MobilistenPlugin.enablePush(token, true / false);
    }
}

Step 6: Run your app with the code given in Step 4.

Step 7: To experiment with the push notification message services, you can initiate a test message to the registered mobile device here.