Skip to main content

User-Level Push Configuration

User-level push configuration refers to push settings specific to the currently logged-in user of the application.

tip
  • User-level push configuration differs from App Key-level push configuration. App Key-level push settings apply to all users under the application. You can adjust some App Key-level push service configurations in the RC Console.
  • User-level push configuration requires the App Key to have User-Level Function Settings enabled. To enable this feature, please submit a ticket.

The following configurations apply to IMKit or IMLib, or other client SDKs that depend on IMLib/IMKit.

Set User Push Language Preference

Sets the display language preference for push notifications for the currently logged-in user. When no user preference is set, the App Key-level Push Language setting will be used.

RC's built-in message types include formatted text strings in their default push content. For example, when a user receives a file message push in a one-to-one chat, the notification content will display the Simplified Chinese string [文件] by default. If the user changes their push language preference to American English en_US, the formatted text string in subsequent file message notifications will appear as [File].

The [文件] and [File] strings in the above example are formatted text strings. Currently, RC's server provides formatted text strings for built-in message types' push content, supporting Simplified Chinese zh_CN, American English en_US, and Arabic ar_SA. Apps can combine this with the [Custom Multilingual Push Template] feature to support additional push languages in notifications.

Interface

RongIMClient.getInstance().setPushLanguageCode(languageCode,callback);

Parameter Description

ParameterTypeDescription
languageCodeStringSets the display language for push notifications. Currently supported built-in push languages are zh_CN, en_US, and ar_SA. For custom push languages, ensure consistency with the language identifiers in Console > Custom Push Content.
callbackOperationCallbackOperation callback

Example Code

RongIMClient.getInstance().setPushLanguageCode(languageCode,
new RongIMClient.OperationCallback() {

/**
* Success callback
*/
@Override
public void onSuccess() {

}

/**
* Error callback
* @param errorCode Error code
*/
@Override
public void onError(RongIMClient.ErrorCode errorCode) {

}
});

After successful configuration, when the current user receives push notifications for built-in message types, the formatted text strings in the push content will be adjusted according to the selected language. You can also modify the default push language configuration for the App Key in RC at RC Console, under Chat > Chat settings > Offline push > Push notification language.

Set User Push Notification Detail Preference

When no user preference is set, push notification details are displayed by default. This feature allows the currently logged-in user to configure whether push notifications should display content details. If set to hide details, notifications will show the formatted text string "You have received a notification" (this string supports Simplified Chinese zh_CN, American English en_US, and Arabic ar_SA).

Interface

RongIMClient.getInstance().setPushContentShowStatus(showStatus,callback);

Parameter Description

ParameterTypeDescription
showStatusbooleanWhether to display push details. true: Show details. false: Hide details.
callbackOperationCallbackOperation callback

Example Code

boolean showStatus = false; // Hide push notification details

RongIMClient.getInstance().setPushContentShowStatus(showStatus,
new RongIMClient.OperationCallback() {

/**
* Success callback
*/
@Override
public void onSuccess() {

}

/**
* Error callback
* @param errorCode Error code
*/
@Override
public void onError(RongIMClient.ErrorCode errorCode) {

}
});

Note that when sending messages, you can specify forceShowDetailContent to override the recipient's configuration and force display of push notification details. Below are platform-specific implementations:

  • Android: Message's MessagePushConfig property. Refer to the MessagePushConfig Property Description in Android's Send Message documentation.
  • iOS: RCMessage's RCMessagePushConfig property. See Configuring Message Push Properties under iOS's APNs Push Development Guide.
  • Web: IPushConfig
  • IM Server API: If the interface provides the forceShowPushContent parameter, this feature is supported.

You can also modify the default configuration for the App Key in RC. If needed, submit a ticket to request changes to the App Key-level Push Notification Details setting. When disabled, all push notifications will hide content details by default.

Set User Multi-Device Push Preference

Configures whether offline mobile devices should receive push notifications when the user is online via Web or PC clients. Note: This interface is only available when the App Key has Web/PC Online Mobile Push Receipt enabled.

You can modify App Key-level configurations in the Console's Feature Configuration page.

  • If the App Key does not have Web/PC Online Mobile Push Receipt enabled, all app users will not receive pushes on offline mobile devices when online via Web/PC clients. Users cannot modify this preference.
  • If the App Key has Web/PC Online Mobile Push Receipt enabled, logged-in users can toggle this behavior. When set to false, mobile devices won't receive pushes while the user is online via Web/PC clients.

Interface

RongIMClient.getInstance().setPushReceiveStatus(receiveStatus,callback);

Parameter Description

ParameterTypeDescription
receiveStatusbooleanWhether mobile devices receive pushes when other clients are online. true: Receive pushes. false: Don't receive pushes.
callbackOperationCallbackOperation callback

Sample Code

boolean receiveStatus = false; // The current user does not want to receive push notifications when Web/PC is online

RongIMClient.getInstance().setPushReceiveStatus(receiveStatus,
new RongIMClient.OperationCallback() {

/**
* Success callback
*/
@Override
public void onSuccess() {

}

/**
* Error callback
* @param errorCode Error code
*/
@Override
public void onError(RongIMClient.ErrorCode errorCode) {

}
});
<!-- links -->
[Custom Multilingual Push Templates]: https://help.rongcloud.cn/t/topic/1030