Multi-device support

Update time: 2024/01/03 02:36:23

NIM SDK provides the capability to configure multi-device push strategies. This means that when desktop clients (including Windows, Web, and macOS) are online, the SDK allows you to specify whether push notifications should be sent to mobile clients.


You have implement the push service.


  1. Register multi-device push event observers to listen for updates on multi-device push events by calling observeMultiportPushConfigNotify Sample code:

    javaprivate void registerObservers(boolean register) {
                pushConfigObserver, register);
    Observer<Boolean> pushConfigObserver = (Observer<Boolean>) aBoolean -> ToastHelper.showToast(
            SettingsActivity.this, "receive multiport push config:" + aBoolean);
  2. Specify whether a push notification is sent to mobile clients is the desktop client is online by calling updateMultiportPushConfig.

    If isOpen is set to true, no push notifications are sent to mobile clients.

    Sample code:

                    .setCallback(new RequestCallback<Void>() {
                        public void onSuccess(Void param) {
                            ToastHelper.showToast(SettingsActivity.this, "设置成功");
                        public void onFailed(int code) {
                            ToastHelper.showToast(SettingsActivity.this, "failure, code:" + code);
                        public void onException(Throwable exception) {
  • You can get the setting for multi-device support by calling isMultiportPushOpen.
  • If you initialize the IM SDK with multi-device login and the support for multi-device push service is enabled, every client that meets the push criteria will receive push notifications. If you want to prevent all devices from receiving push notifications at the same time, you can disable multi-device login or push service support.
Was this page helpful?
  • Prerequisites
  • Implementation