User-Level push settings
User-level push notification configuration refers to push settings applied to the currently logged-in user of your app.
- User-level push configuration is distinct from App Key-level push configuration. App Key-level settings apply to all users under an App Key. You can adjust some App Key-level push service settings in the console.
- User-level push configuration requires that the User-Level Feature Settings capability is enabled for your App Key. To enable it, submit a support ticket.
User-level push configuration is implemented through the underlying SDK.
Set the user's push notification language preference
Set the display language preference for push notifications for the currently logged-in user. If no preference is set, the App Key-level Push notification language setting is used.
Built-in message types include format text strings in their default push content. For example, when a user receives a push notification for a file message in a direct channel, the notification displays the US English string [File] by default. If the user changes their push language preference to another supported language, the format text string in subsequent file message notifications is displayed in that language.
The [File] example above is a format text string. The server currently provides format text strings for push content of built-in message types, supporting Simplified Chinese (zh_CN), US English (en_US), and Arabic (ar_SA). You can also use the custom multilingual push template feature to support additional push languages in a single push notification.
Parameters
| Parameter | Type | Description |
|---|---|---|
| languageCode | String | The language to display in push notifications. Built-in push languages currently supported: zh_CN, en_US, ar_SA. For custom push languages, use the language identifier configured in the console. |
| callback | OperationCallback | Operation callback |
Example
RongCoreClient.getInstance().setPushLanguageCode(languageCode,
new IRongCoreCallback.OperationCallback() {
@Override
public void onSuccess() {
// Successfully set
}
@Override
public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
// Failed to set
}
});
After a successful call, format text strings in push notifications for built-in message types received by this user are adjusted to the specified language. You can also change the default push language for your App Key in the console at Chat > Chat settings > Offline Push > Push notification language.
Set the user's push notification detail preference
By default, push notifications display message content. This feature allows the currently logged-in user to control whether push notifications show content details. If the user opts out of showing details, push notifications display the format text string "You have received a notification" (supported in Simplified Chinese zh_CN, US English en_US, and Arabic ar_SA).
Parameters
| Parameter | Type | Description |
|---|---|---|
| showStatus | boolean | Whether to show push notification details. true: show details. false: hide details. |
| callback | OperationCallback | Operation callback |
Example
boolean showStatus = false;
RongCoreClient.getInstance().setPushContentShowStatus(showStatus,
new IRongCoreCallback.OperationCallback() {
@Override
public void onSuccess() {
// Successfully set
}
@Override
public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
// Failed to set
}
});
Note that when sending a message, you can specify forceShowDetailContent to override the recipient's preference and force push notification content details to be shown. Set this via the message's PushConfig property.
You can also change the App Key-level default. If needed, submit a support ticket to change the App Key-level Push Notification Details setting. Once disabled, all push notifications will hide message content by default.
Set the user's multi-Device push receive preference
Configure whether offline mobile devices should receive push notifications when the currently logged-in user is active on the Web or PC client. Note that this API is only available after Send to mobiles when web/PC online is enabled for your App Key.
You can modify the App Key-level configuration on the Chat settings page in the console under Chat > Chat settings > Offline Push.
- If Send to mobiles when web/PC online is not enabled for the App Key, mobile devices are never sent push notifications while the user is online on Web or PC. Users cannot change this behavior individually.
- If Send to mobiles when web/PC online is enabled for the App Key, the currently logged-in user can toggle this behavior on or off. After successfully setting it to
false, the user's mobile devices will not receive push notifications while the user is online on Web or PC.
Parameters
| Parameter | Type | Description |
|---|---|---|
| receiveStatus | boolean | Whether the mobile device receives push notifications when another client is online. true: receive push notifications. false: do not receive push notifications. |
| callback | OperationCallback | Operation callback |
Example
boolean receiveStatus = false;
RongCoreClient.getInstance().setPushReceiveStatus(receiveStatus,
new IRongCoreCallback.OperationCallback() {
@Override
public void onSuccess() {
// Successfully set
}
@Override
public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
// Failed to set
}
});