Push Notification Settings
How to configure Push notifications for Android SDK in Zoho SalesIQ?
Step 1: In the Zoho SalesIQ console, navigate to Settings > Brands > Installation > Android, and enable Push notification.
Step 2: Add Firebase to your Android project. How to add Firebase to my Android project.
Step 3: Get the private key (JSON file) from Google services. A Private key (JSON) that authorizes your app to access Google services, including sending messages via Firebase Cloud Messaging. Follow the steps here to set up FCM service.
Note: Legacy FCM API to HTTP v1 API Migration guide
Before you proceed with the below steps, check the listed requirements:
- Create a project in the firebase.
- Add your app to the created Firebase project
- Override onNewToken() method from the FirebaseMessagingService class
- Override onMessageReceived() methods method from the FirebaseMessagingService class
Step 4: Click the Settings icon in the Firebase console and navigate to Project Settings > Service accounts. Under the Firebase Admin SDK, select Node.js and click on Generate new private key.
Step 5: Click Browse, select the private key file, and click Upload.
Step 6: 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 7: Create a Java class that extends the FirebaseMessagingService, the service where the app's Firebase messaging token will be received, which will be used by the SalesIQ to register your app for the push. To allow us to draw the ZohoSalesIQ pushes, you should set up the FirebaseMessagingService as follows:
Copied
package <package-name>;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.zohosalesiq.mobilisten.ZohoSalesIQPlugin;
import com.zohosalesiq.plugin.MobilistenPlugin;
import java.util.Map;
public class MyFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Map extras = remoteMessage.getData();
ZohoSalesIQPlugin.handleNotification(this.getApplication(), extras);
// Process the push message and generates a notification if it's orginated from SalesIQ
}
@Override
public void onNewToken(String token) {
ZohoSalesIQPlugin.enablePush(token, --true / false --);
// Pass "true" for only testing purpose, upon production strictly pass "false"
// For testing the push notification, navigate to as per below instruction
// (Settings > Brands > Select your brand > Installation >
// Android > Configure push notification > Registered mobile devices)
}
}
AndroidManifest.xml
Copied
<manifest
xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:icon="@mipmap/ic_launcher">
<!-- Your code -->
<service
android:name=".MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
</manifest>
Note: The google-services.json file and FCM credentials must be taken from the same Firebase project. If you're experiencing any issues, try reinstalling the app from the beginning.
Step 8: Run your app with the implementation..
Step 9: To experiment with the push notification message services, you can initiate a test message to the registered mobile device here.
Step 10: Notification channel
The mobilisten notification channel name can be changed with the string attribute - mobilisten_notification_channel_name
Copied
<string name="mobilisten_notification_channel_name">Support notifications</string>
Note: By default, the notification channel name will be "Zoho SalesIQ".