3. In the top-left pane, click on the settings icon beside Project Overview.
4. Click Project settings.
5. Inside Project Settings, navigate to Service accounts.
6. Click Generate new private key.
7. This will generate a service account JSON file containing the Private key.
9. Ensure the Firebase Cloud Messaging (FCM) API (V1) is enabled under the Cloud Messaging of the FCM console.
10. If it's disabled, click the three-dot icon beside the Firebase Cloud Messaging API (V1), and select Manage API in Google Cloud Console and click Enable.
How to set up a Firebase Cloud Messaging (FCM) on client app for Android:
Once FCM is setup, follow the below steps to begin receiving notifications in the device.
1. Add the below code to the app level manifest file. This enables us to receive notification from Firebase.
- <service android:name=".NotificationFCMReceiver"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
2. Add the class which extends FirebaseMessagingService to your App’s project. Please refer to the below code based on your preferred language:
For JAVA, use the below code:
- import com.google.firebase.messaging.FirebaseMessagingService;
- import com.google.firebase.messaging.RemoteMessage;
- import com.zoho.pagesense.android.PSNotification;
- public class NotificationFCMReceiver extends FirebaseMessagingService {
- @Override
- public void onNewToken(@NonNull String s) {
- super.onNewToken(s);
- PSNotification.sendDeviceToken(s);
- }
- @Override
- public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
- super.onMessageReceived(remoteMessage);
- if(PSNotification.isFromPageSensePlatform(remoteMessage.getData())) {
PSNotification.showNotification(remoteMessage.getData(), - com.zoho.pagesense.android.R.drawable.notification_bg);
- }
- }
- }
For KOTLIN, use the below code:
- import com.google.firebase.messaging.FirebaseMessagingService
- import com.google.firebase.messaging.RemoteMessage
- import com.zoho.pagesense.android.PSNotification
- class NotificationFCMReceiver : FirebaseMessagingService() {
- override fun onNewToken(s: String) {
- super.onNewToken(s)
- PSNotification.sendDeviceToken(s)
- }
- override fun onMessageReceived(remoteMessage: RemoteMessage) {
- super.onMessageReceived(remoteMessage)
- if (PSNotification.isFromPageSensePlatform(remoteMessage.data)) {
- PSNotification.showNotification(remoteMessage.data,
- com.zoho.pagesense.android.R.drawable.notification_bg)
- }
- }
- }

- onNewToken will be called when device token is generated. Use the API PSNotification.sendDeviceToken(s) to send the token to Zoho PageSense.
- onMessageReceived will be called when a notification is received. Here, you will need to call the PSNotification.isFromPageSensePlatform(remoteMessage.getData()) API to check whether notification is from Pagesense or not. After that, you need to call API PSNotification.showNotification(remoteMessage.getData(), com.zoho.pagesense.android.R.drawable.notification_bg); by sending the data and notification icon.
Permissions required for run-time:
In Android 12 and above, the below permissions should be enabled to process the call and snooze buttons inside notifications.
- <uses-permission android:name="android.permission.CALL_PHONE"/>
- <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
We hope this documentation helps make the process easy for you. Please feel free to reach out to us anytime by dropping an email to
support@zohopagesense.com if you need more explanation or have any questions.