API | Description |
Register Push Service, optionally override push information from interface parameter JSON. | |
Unregister Push Service. | |
RegistrationID is the unique identifier ID of the push receiving device. By default, this ID is automatically generated when the push service is successfully registered, but you can also customize the setting. You can push messages to the specified device based on the RegistrationID. Note that uninstalling and reinstalling the device will change the RegistrationID, so you need to call the setRegistrationID interface before registering the push service. | |
After successfully registering the push service, you can get the unique identifier ID of the push receiving device, that is, the RegistrationID, by calling the getRegistrationID interface. You can push messages to the specified device based on the RegistrationID. |
API | Description |
Add Push listener. | |
Remove Push listener. |
API | Description |
Specify offline push to use the FCM channel for the device. This needs to be called before registering the push service. | |
Disable the notification bar when the app is in the foreground. |
void _onNotificationClicked({required String ext, String? userID, String? groupID}) {print("_onNotificationClicked: $ext, userID: $userID, groupID: $groupID");/// Custom Processing}TencentCloudChatPush().registerPush(onNotificationClicked: _onNotificationClicked,sdkAppId: Your sdkAppId,appKey: "client key",apnsCertificateID: Your configured Certificate ID);
Parameter | Type | Description | | |
onNotificationClicked | ext | String | The complete ext information carried by the message is specified by the sender. If not specified, there is a default value. You can parse this field to navigate to the corresponding page. | |
| userID | String? | This parameter corresponds to userID. It automatically tries to parse the ext JSON String to obtain the userID of the other party in a single chat. Note: If you have not customized the ext field, which is specified by the SDK or UIKit by default, you can use the default parsing here. If the parsing attempt fails, it will be null. | |
| groupID | String? | This parameter corresponds to groupID. It automatically tries to parse the ext JSON String to obtain the groupID information for group chats. Note: If you have not customized the ext field, which is specified by the SDK or UIKit by default, you can use the default parsing here. If the parsing attempt fails, it will be null. | |
sdkAppId | | int? | The application ID assigned to you by the IM console | |
appKey | | String? | Client key assigned to you by the IM console | |
apnsCertificateID | | int? | This item can be omitted if the setApnsCertificateID method is already configured separately. | |
TencentCloudChatPush().unRegisterPush();
Parameter | Description |
registrationID | Device push ID, which will change after uninstalling and reinstalling. |
TencentCloudChatPush().setRegistrationID(registrationID: registrationID);
TencentCloudChatPush().getRegistrationID();
TIMPushListener timPushListener = TIMPushListener(onRecvPushMessage: (TimPushMessage message) {String messageLog = message.toLogString();debugPrint("message: $messageLog");},onRevokePushMessage: (String messageId) {debugPrint("message: $messageId");},onNotificationClicked: (String ext) {debugPrint("ext: $ext");});TencentCloudChatPush.addPushListener(listener: timPushListener);
TIMPushListener timPushListener = TIMPushListener(onRecvPushMessage: (TimPushMessage message) {String messageLog = message.toLogString();debugPrint("message: $messageLog");},onRevokePushMessage: (String messageId) {debugPrint("message: $messageId");},onNotificationClicked: (String ext) {debugPrint("ext: $ext");});TencentCloudChatPush.removePushListener(listener: timPushListener);
Parameter | Description |
enable | true: Use FCM channel. false: use the native channel. |
TencentCloudChatPush.forceUseFCMPushChannel(enable: true);
Parameter | Description |
disable | true: disable false: enable |
TencentCloudChatPush.disablePostNotificationInForeground(disable: true);
Was this page helpful?