Hyphenate Docs

Start Chatting with Hyphenate!

Welcome to the Hyphenate docs portal. Here you'll find comprehensive guides and technical documentation to help you integrate Hyphenate In-App Chat.

Get Started

Push Notification

Setup Push Service on Hyphenate Console

In order to implement push notifications, you need to set up the Google GCM/FCM project and API first. Here's the guide:

When will the Hyphenate server push 'push notifications'?

Hyphenate will only push 'push notifications' to the user if the user is offline, which means the user's device is disconnected from the Hyphenate server. This could occur within the following scenarios:

  1. The app is terminated, NOT just in the background
  2. User logs out from the app

Hyphenate will NOT push 'push notifications' if the long connection to the Hyphenate service exists, which could fall under:

  1. User logs in and the app is in the foreground
  2. App is in the background, but the SDK will keep the long connection alive for an extended period of time

To test the push notification for a terminated app, simply go your home screen and terminate the app by swiping it out.


Note that FORCE STOP on the Android app will TERMINATE the GCM service. As a result, the app will NOT be able to receive the push notification anymore. SettingsApps under Device section → click Hyphenate Demo → click FORCE STOP button.


1. Initialize push notifications for SDK

public void init(Context context) {
    if (isMainProcess()) {
        //init hyphenate sdk with options
        EMOptions options = new EMOptions();
        //set gcm project number

        EMClient.getInstance().init(context, options);

2. Disconnect from Chat Service

When logging out of your app, you need to unbind the device token. Call the logout method
EMClient.getInstance().logout(true) or EMClient.getInstance().logout(true, callback).
In case if you want to conditionally connection/disconnect user from the chat server, but continue to receive the push notification, then you can call the method logout() or logout(true, callback) and passing YES for parameter unbindDeviceToken.

 *  @param boolean unbindDeviceToken     Unbind device token to disable the Apple Push Notification Service
 *  @param callback         The callback of completion block
public void signOut(boolean unbindDeviceToken, final EMCallBack callback)

Push Notification Settings

Get push configurations from the server


This step is required every time if the app was previously terminated and restarted, because the user could update the push settings on another device, getting the latest update from the server instead of saving locally to avoid inconsistency.

Update push service settings and push the changes to the Hyphenate server

EMClient.getInstance().pushManager().updatePushServiceForGroup(List<String> groupIds, boolean noPush)

Get Group push notifications turned off


Push Notification to iOS devices

iOS relies on APNs (Apple push notifications services) for push notifications to offline iOS users. As a result, this requires you, as a developer, to set up a user nickname for APNs. The nickname will be used as the display name for push notifications. Otherwise, the system default will use the Hyphenate ID as the nickname. However, it's not likely that personal information will be displayed. We recommend that you match the nickname with the user's profile name.

set user nickname


Next Section: Setup Firebase Cloud Messaging

Updated 2 years ago

Push Notification

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.