Notifications Android

Configure Push and In-app notifications.

Configure push notifications via Helpshift


Helpshift enables you to send notifications to your users. This is particularly useful when you have multiple users on multiple platforms like iOS and Android. Notifications are useful to tell your users when you reply to an issue that they submitted. When the app is backgrounded, the notification that is sent from Helpshift appears as a notification.

Refer to the following link for documentation on GCM Push:- Google Cloud Messaging for Android

For Helpshift Admin Interface

To enable the Helpshift system to send push notifications to your users you will have to add your GCM Key and Bundle Name via the helpshift admin interface.

Enter your Google Push notifications credentials per app, via the Settings page > App listing in the left navigation > Scroll down to Push Notifications settings section for the app.


The API key can be found at your Google API Console.

GCM Console.png

Configure the Helpshift Unity SDK to handle notifications

In built support

Helpshift Unity plugin comes with built-in support for Push notifications. If you want to use the Helpshift push notification handling, please call the HelpshiftSdk.registerForPush(string yourGcmSenderId) API inside your applications init code. Also you need to uncomment the permissions in the AndroidManifest for Helpshift. Go to Assets->Plugins->Android->helpshift->AndroidManifext.xml. Uncomment the following permissions :

<!-- App receives GCM messages. -->
<!--permission android:name="${applicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
<uses-permission android:name="" /-->
<!-- GCM requires a Google account. -->
<!--uses-permission android:name="android.permission.GET_ACCOUNTS" /-->
<!-- Keeps the processor from sleeping when a message is received. -->
<!--uses-permission android:name="android.permission.WAKE_LOCK" /-->

<!--receiver android:name="com.helpshift.gcm.HSGcmBroadcastReceiver" android:permission="" >
        <action android:name="" />
        <action android:name="" />
        <category android:name="${applicationId}" />
<service android:name="com.helpshift.gcm.HSGcmIntentService" /-->

If you are using gradle build system then ${applicationId} is automatically replaced during build time.

Otherwise, manually replace ${applicationId} with your app's bundle identifier.

If you are targeting the app on Android API level 26 and above, then GCM will crash if the push notification is received when the app is in background or not running. We recommend to move the manual FCM integration as described here

Manual support

If you have integrated push notifications to receive updates from the Helpshift's push notification service, please use the HelpshiftSdk.registerDeviceToken(string deviceToken) API to register the device token with the Helpshift SDK.

Once this is done, you can use the HelpshiftSdk.handlePushNotification(Dictionary<string, object> pushNotificationData) API to send the payload received in the notification.

To check whether this notification is being sent from the Helpshift's push notification service, please check the origin field of the notification. If it is "helpshift", the notification is a Helpshift notification.

public void OnTokenReceived(object sender, Firebase.Messaging.TokenReceivedEventArgs token) {
    _support.registerDeviceToken (token.token);

public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e) {
    IDictionary<string, string> pushData = e.Message.Data;

        if (pushData.ContainsKey ("origin") && pushData ["origin"].Equals ("helpshift")) {
            Dictionary<string, object> hsPushData = new Dictionary<string, object>();

            foreach (string key in hsPushData.Keys) {
            hsPushData.Add (key, pushData [key]);
        _support.handlePushNotification (hsPushData);

GCM.SetRegisteredCallback ((string registrationId) => {

GCM.SetMessageCallback ((Dictionary<string, object> table) => {
    if(table["origin"].Equals("helpshift")) {

If your application is not running and it receives a push notification then it will start the application in background (by invoking the push notification receiver registered in java). In this case, UnityEngine might not be initialized and the C# api HelpshiftSdk.handlePushNotification might not be useful.

If you are unable to delegate the push notification payload from the Java receiver class to C# api's then, for such cases, you can use the native Java api HelpshiftUnity.handlePush(Context context, Intent intent) to handle push notifications from Helpshift.

There is a known issue with the Helpshift Unity SDK 4.0.0, in which a NullPointerException occurs; when the application is in the stopped state and a push notification is received and handled using the HelpshiftUnity.handlePush(context, intent); API. Please call HelpshiftUnity.install(getApplication()); before calling HelpshiftUnity.handlePush(context, intent); to resolve this issue.

In Java implementation of the receiver for push notifications, you can use this api as in the following example.

public class MyGcmIntentService extends GCMBaseIntentService {
    protected void onMessage(Context context, Intent intent) {
    Log.v(TAG, "onMessage");
    try {
        if (intent.getExtras().getString("origin").equals("helpshift")) {
            Log.d(TAG, "Got Helpshift push notification");
            HelpshiftUnity.install(getApplication()); // For Helpshift Unity SDK 4.0.0.
            HelpshiftUnity.handlePush(context, intent);
    catch (Exception e) {
        Log.e(TAG, "Exception : " + e.getMessage());

Support with other push notification plugins

If you are using any other plugin for push notifications like prime31,onesignal etc. you can use HelpshiftSdk.registerDeviceToken(string deviceToken) API to register the device token. You need to call this API from the registrationSucceededEvent in your plugin. The following is an example for prime31 plugin.

For Example :

void registrationSucceededEvent( string registrationId )
    Debug.Log( "registrationSucceededEvent: " + registrationId );
    HelpshiftLog.e ("Helpshift-HS", registrationId);
    help.registerDeviceToken (registrationId);

Once this is done, you can use the HelpshiftSdk.handlePushNotification(Dictionary<string, object> pushNotificationData) API to send payload which you receive in the notificationReceivedEvent callback in your plugin.

To check whether this notification is being sent from the Helpshift's push notification service, please check the origin field of the notification. If it is "helpshift", the notification is a Helpshift notification.

If you are using other push notification service do not uncomment the permissions in the Helpshift AndroidManifest.xml located at Assets/Plugins/Android/helpshift/AndroidManifest.xml.

In-app notifications

In-app notifications are similar to notifications in the notification drawer . Unlike push notifications, they appear only when you app is running.

These notifications are sent when an agent replies to a customer's issue. Your customers can go straight into the conversation screen when they tap on the notification.

If the GCM/FCM device token is registered for push notifications, then in-app notifications will be disabled. In-app notifications are disabled to avoid duplicate notifications from both push notifications and in-app notifications.

Configuring in-app notifications

If you do not want the in-app notifications support provided by the Helpshift SDK, please set this flag to "no". The default value of this flag is "yes" i.e in-app notifications will be enabled.
Read more about in-app notifications in the Notifications section.

"yes" / "no"


using Helpshift;
private HelpshiftSdk help; = HelpshiftSdk.getInstance();
Dictionary<string, string> configMap = new Dictionary<string, string>();
configMap.Add("unityGameObject", "DemoControl");
configMap.Add("enableInAppNotification", "yes");
help.install("<YOUR_API_KEY>", "<YOUR_HELPSHIFT_DOMAIN>", "<YOUR_APP_ID>", configMap);

Showing notification count when replies are sent to the user

Via Helpshift API

If you want to show your user notifications for replies sent by the Agent to their Issues, you can use notification counts provided by the Helpshift SDK. These give you the total number of unread messages and display that number as a badge. You can get notification counts asynchronously by implementing the Helpshift delegate method didReceiveUnreadMessageCount. Notifications are typically displayed as badges inside your app where a user clicks on the help section. These badges can be displayed anywhere in your app's interface to tell the user that they have unread replies/messages from you.

You can implement the "didReceiveUnreadMessageCount" delegate method like the following example:

using Helpshift;
private HelpshiftSdk help; = HelpshiftSdk.getInstance();

public void didReceiveUnreadMessagesCount(int count) {
    // your code here

Via In-App Notifications

If you want to use the in-app notifications mechanism to get the count of unread notifications, you can implement the didReceiveInAppNotificationCount message handler on the Game object which you have registered at the time of install.

For example

public void didReceiveInAppNotificationCount(string count) {
    Debug.Log("In-app Notification count : " + count);