Notifications iOS

Configure Push notifications 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 badge or sound alert or both and appears with the App icon in the iOS Notification Center.

Configure Helpshift's push notification service in the Helpshift admin interface

Set up your application with Apple and enable push notifications. Download the Push Notifcation Certificate from Apple's developer portal, and double click on it to import it to the Keychain Access application.

In the Keychain Access application right click on the certificate that was just added and click export it in .p12 format. Please provide a password while exporting the certificate (We do not accept empty passwords). Note that if your development private key is not present in Keychain Access you will not be able to export it in .p12 format. Once you have exported the .p12 file you can login and upload that file in your app settings in the Helpshift admin panel. Provide the same password you used while exporting to .p12 format.

helpshift-push-notifications.png

Set the Production / Development mode options, depending on whether your Apple push certificate was for testing (development push) or production. You can configure whether to send a badge or not, and sound alerts if you provided custom sounds bundled with your app to handle notifications. Save it and you're all set.

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 register your application to receive push notifications. The Helpshift SDK overrides the UnityAppController class to listen to the application delegates for Push notifications and calls the appropriate Helpshift APIs. If you already have a UnityAppController child class, please make sure it inherits from the HsUnityAppController class.

Manual support

For Helpshift SDK to work with the push notification service you will need to invoke the [HelpshiftCore registerDeviceToken:] API call inside the application delegate method didRegisterForRemoteNotificationsWithDeviceToken. You can find the function overridden inside the HsUnityAppController.mm class.

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
    [HelpshiftCore registerDeviceToken:deviceToken]
}

Whenever a push notification is received, the application delegate for notification received gets called. If the "origin" field of the notification dictionary is "helpshift", call HelpshiftSdk.handlePushNotification(Dictionary<string, object> pushNotificationData) api with the notification dictionary. The Helpshift SDK will launch the appropriate screen based on the action on notification click.

In-app notifications

Applicable to SDK version 2.4.0-rc-1 and above

In-app notifications are similar to Apple's push notification banners. Unlike push notifications, they appear within your app when it is in use by the user.

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

In-app Notifications on iOS 7

iOS Simulator Screen shot 16-Sep-2013 2.42.30 PM.png

iOS Simulator Screen shot 16-Sep-2013 2.42.55 PM.png

iOS Simulator Screen shot 16-Sep-2013 2.43.07 PM.png

In-app Notifications on iOS 6

inapp_new.PNG

inapp_more.PNG

inapp_notif_center.PNG

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.

Flag
enableInAppNotification
Values
"yes" or "no"
Default
"yes"

Example:

private HelpshiftSdk help;
this.help = HelpshiftSdk.getInstance();
Dictionary<string, string> configMap = new Dictionary<string, string>();
configMap.Add("unityGameObject", "DemoControl");
configMap.Add("enableInAppNotification", "yes");
help.install("<API_KEY>", "<DOMAIN_NAME>", "<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 on the issues posted, you can get the notification count synchronously from cache.

For example

Integer notifCount = helpshift.getNotificationCount(false);

If you want to fetch the notification count from the server asynchronously, you can pass call the getNotificationCount API with a true param value.

For example

helpshift.getNotificationCount(true);

In such a scenario, the return value of the function should be ignored. To get the actual count of unread notifications, you should implement the didReceiveNotificationCount message handler on the Game object which you have registered at the time of install.

For example

public void didReceiveNotificationCount(string count) {
    Debug.Log("Notification async count : " + count);
}

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);
}