API | Description |
Register Push Service (Must be called after the App user has agreed to the privacy policy to use the push service). | |
Unregister and disable the 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 |
Disable the notification bar when the app is in the foreground. |
API | Description |
Only support calling in Notification Service Extension's '- didReceiveNotificationRequest:withContentHandler:' method. The appGroup identifies the App Group shared between the main app and the Extension. It needs to be configured in the App Groups capability of the main app's capability. |
Parameter | Description | Get Path |
sdkAppId | The application ID assigned to you by the Chat console. | |
appKey | The client key assigned to you by the Chat console. | |
const int sdkAppId = your sdkAppId;static const NSString *appKey = @"Client Key";[TIMPushManager registerPush:sdkAppId appKey:appKey succ:^(NSData * _Nonnull deviceToken) {//} fail:^(int code, NSString * _Nonnull desc) {//error}];
[TIMPushManager unRegisterPush:^{//success} fail:^(int code, NSString * _Nonnull desc) {//error}];
Parameter | Description |
registrationID | Device push ID, which will change after uninstalling and reinstalling. |
Parameter | Description |
disable | true: close false: open |
request | |
appGroupID | The appGroup identifies the App Group shared between the main app and the Extension. It needs to be configured in the App Groups capability of the main app's capability. |
callback | typedef void(^TIMPushNotificationExtensionCallback)(UNNotificationContent *content) Statistics function Callback, carrying content information. |
@implementation NotificationService- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {//The appGroup identifies the App Group shared between the main app and the Extension. It needs to be configured in the App Groups capability of the main app's capability.//Format: group + [mainBundleID] + key//E.g., group.com.tencent.im.pushkeyNSString * appGroupID = kTIMPushAppGorupKey;__weak typeof(self) weakSelf = self;[TIMPushManager handleNotificationServiceRequest:request appGroupID:appGroupID callback:^(UNNotificationContent *content) {weakSelf.bestAttemptContent = [content mutableCopy];// Modify the notification content here...// self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]", self.bestAttemptContent.title];weakSelf.contentHandler(weakSelf.bestAttemptContent);}];}@end
API | Description |
onRecvPushMessage | Received Push message. |
onRevokePushMessage | Received a notification of Push message recall. |
onNotificationClicked | Notification bar message click callback |
Was this page helpful?