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
Parameter | Type | Description |
---|---|---|
disableNotification | bool | Whether 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. |
disablePushTitle | bool | Whether 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. |
pushTitle | string | The 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. |
pushContent | string | The 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. |
pushData | String | Additional information for remote push notifications. If not set, the pushData value set in the message sending parameters will be used. |
forceShowDetailContent | bool | Whether 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. |
iOSPushOptions | RCIMIWIOSPushOptions | Push 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. |
androidPushOptions | RCIMIWAndroidPushOptions | Push 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. |
templateId | String | The 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). |
voIPPush | bool | If the target device is iOS, setting isVoIPPush to True will push the notification through the VoIP channel. |
iOSPushOptions
Property Description
Parameter | Type | Description |
---|---|---|
threadId | String | The iOS platform notification group ID. Push notifications with the same threadId will be grouped together (supported from iOS 10). |
category | String | The 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 . |
apnsCollapseId | String | The 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). |
richMediaUri | String | The URL of the iOS rich push content, used together with category . |
androidPushOptions
Property Description
Parameter | Type | Description |
---|---|---|
notificationId | String | The 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 . |
channelIdMi | String | The 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. |
channelIdHW | String | The 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. |
channelIdOPPO | String | The 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. |
pushTypeVIVO | RCIMIWVIVOPushType | The VIVO push channel type. If the developer has integrated VIVO push and needs to specify the push type, they can set this. |
collapseKeyFCM | String | The 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. |
imageUrlFCM | String | The 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. |
importanceHW | String | The message level for Huawei push notifications. |
imageUrlHW | String | The URL of the large icon on the right side of the Huawei notification bar. If not set, the icon will not be displayed. |
imageUrlMi | String | The URL of the large icon for Xiaomi notifications. |
channelIdFCM | String | The 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 Channel | Configuration Instructions |
---|---|
Huawei | On the app side, call the Android SDK to create the Channel ID. |
Xiaomi | Create the Channel ID on the Xiaomi Open Platform management console or through the Xiaomi server API. |
OPPO | On the app side, call the Android SDK to create the Channel ID; register the Channel ID on the OPPO management console to ensure consistency. |
vivo | Call the server API to create the Channel ID. |
External Links
You can learn more about Channel ID through the following links:
- Xiaomi Push: Xiaomi Push Message Classification New Rules
- Huawei Push: Custom Notification Channels
- OPPO Push: Push Private Channel Application
- vivo Push: Message Classification Function Description