Skip to main content

Configure Push Notification Attributes for Messages

When sending a message, you can customize the push behavior of a single message by setting the pushOptions object in the message.

Example Code

RCIMIWTextMessage? textMessage = await engine?.createTextMessage(
conversationType,
targetId,
channelId,
text,
);

RCIMIWAndroidPushOptions androidPushOptions = RCIMIWAndroidPushOptions.create();
// Configure Android parameters here

RCIMIWIOSPushOptions iosPushOptions = RCIMIWIOSPushOptions.create();
// Configure iOS parameters here

textMessage.pushOptions = RCIMIWMessagePushOptions.create(
disableNotification: false,
pushContent: arg['pushContent'],
pushData: arg['pushData'],
androidPushOptions: androidPushOptions,
iOSPushOptions: iosPushOptions
);
code = await engine?.sendMessage(message);

pushOptions Property Description

ParameterTypeDescription
disableNotificationboolWhether to hide the notification title in the notification bar. If set to true, the notification title will not be displayed. If set to false, the notification title will be displayed. By default, RC uses the username for one-to-one chat messages and the group name for group chat messages as the notification title. Setting this property will prevent the notification title from being displayed.
disablePushTitleboolWhether to hide the notification title. This property is only valid for iOS platform users. Since the notification title is a required field for third-party push platforms on Android, this property is not supported for Android.
pushTitlestringThe push notification title. The title specified here has the highest priority. If not set, refer to the default push notification title and push notification content for each built-in message type in User Content Message Format.
pushContentstringThe push notification content. The content specified here has the highest priority. If not set, refer to the default push notification title and push notification content for each built-in message type in User Content Message Format.
pushDataStringAdditional information for remote push notifications. If not set, the pushData value set in the message sending parameters will be used.
forceShowDetailContentboolWhether to bypass the client's configuration and force the push notification to display the notification content (pushContent).

Client devices can use setPushContentShowStatus to configure the push notification to display only a reminder like "You have received a notification." When sending a message, you can set forceShowDetailContent to 1 to bypass this configuration and force the client device to display the push content in the push notification for this message.
iOSPushOptionsRCIMIWIOSPushOptionsPush notification configuration for the iOS platform. This configuration applies when the target device is an iOS platform device. For detailed information, see the iOSPushOptions Property Description.
androidPushOptionsRCIMIWAndroidPushOptionsPush notification configuration for the Android platform. This configuration applies when the target device is an Android platform device. For detailed information, see the RCIMIWAndroidPushOptions Property Description.
templateIdStringThe push notification template ID. After setting this, the push notification will match the language content set in the template based on the language environment set by the target user through setPushLanguageCode. If no match is found, the default content will be used for the push notification.

The template content can be set in the Console > Custom Push Copywriting. For specific operations, see Configure and Use Custom Multi-Language Push Templates(./push-template).
voIPPushboolIf the target device is iOS, setting isVoIPPush to True will push the notification through the VoIP channel.
  • iOSPushOptions Property Description
ParameterTypeDescription
threadIdStringThe iOS platform notification group ID. Push notifications with the same threadId will be grouped together (supported from iOS 10).
categoryStringThe iOS rich push type is defined by the developer and parsed by the app. It is used together with richMediaUri. When category is set, the push notification will automatically include mutable-content.
apnsCollapseIdStringThe iOS platform notification collapse ID. When apnsCollapseId is the same, the new notification will replace the old one. The maximum length is 64 bytes (supported from iOS 10).
richMediaUriStringThe URL of the iOS rich push content, used together with category.
  • androidPushOptions Property Description
ParameterTypeDescription
notificationIdStringThe unique identifier for Android platform push notifications. Currently supported for Xiaomi and Huawei push platforms. By default, developers do not need to set this. When a message generates a push notification, the message's messageUId is used as the notificationId.
channelIdMiStringThe channel ID for Xiaomi. This is the push channel used for Xiaomi for this message. If the developer has integrated Xiaomi push and needs to specify a channelId, they can obtain it from the Android development team. The channelId is created by the developer.
channelIdHWStringThe channel ID for Huawei. This is the push channel used for Huawei for this message. If the developer has integrated Huawei push and needs to specify a channelId, they can obtain it from the Android development team. The channelId is created by the developer.
channelIdOPPOStringThe channel ID for OPPO. This is the push channel used for OPPO for this message. If the developer has integrated OPPO push and needs to specify a channelId, they can obtain it from the Android development team. The channelId is created by the developer.
pushTypeVIVORCIMIWVIVOPushTypeThe VIVO push channel type. If the developer has integrated VIVO push and needs to specify the push type, they can set this.
collapseKeyFCMStringThe FCM push notification group ID. Supported in SDK version 5.1.3 and above. Note: If this field is used, ensure that the FCM push configuration in the console is set to Notification Message.
imageUrlFCMStringThe URL of the icon on the right side of the FCM push notification bar. If not set, the icon will not be displayed. Supported in SDK version 5.1.3 and above. Note: If this field is used, ensure that the FCM push configuration in the console uses Certificate as the authentication method and Notification Message as the push method.
importanceHWStringThe message level for Huawei push notifications.
imageUrlHWStringThe URL of the large icon on the right side of the Huawei notification bar. If not set, the icon will not be displayed.
imageUrlMiStringThe URL of the large icon for Xiaomi notifications.
channelIdFCMStringThe FCM notification channel ID. The app must create a channel with this channel ID before it can receive any notifications with this channel ID.

The Channel ID needs to be created by the developer as follows:

Push ChannelConfiguration Instructions
HuaweiOn the app side, call the Android SDK to create the Channel ID.
XiaomiCreate the Channel ID on the Xiaomi Open Platform management console or through the Xiaomi server API.
OPPOOn the app side, call the Android SDK to create the Channel ID; register the Channel ID on the OPPO management console to ensure consistency.
vivoCall the server API to create the Channel ID.

You can learn more about Channel ID through the following links: