tencent cloud

Feedback

Last updated: 2024-06-13 10:21:45

    API Overview

    Register/Unregister Push Service Interface

    After initialization and successful log in to IM, you can register for the push service.
    API
    Description
    Register the push service after log in to is complete
    Unregister the offline push service when logging out of the IM account.
    Disable the plugin after logging in to automatically register the push service; it needs to be called before registering the push service

    Statistics on the push arrival rate of TIMPush

    If you need to track the arrival and click data of push notifications, you need to proactively call this function in the Notification Service Extension.
    API
    Description
    It is only supported to be called in the Notification Service Extension's '- didReceiveNotificationRequest:withContentHandler:' method; appGroup indicates the App Group shared between the main App and the Extension. It needs to be configured in the Capability of the main App to enable App Groups.

    Interface details

    Function Description

    + (void)registerPush

    Register the offline push service when the IM account logs in successfully. (The information needed to register the push service comes from the offlinePushCertificateID of the TIMPushDelegate protocol implemented in your AppDelegate)
    Note:
    You need to log in using the login interface provided by TUILogin in the TUICore component, and the plugin will automatically perceive and register the push service.
    If you don't want to use the interface provided by TUILogin, after completing the login operation, you need to manually call this interface to register the service.
    Usage: [TIMPush registerPush];

    + (void)unRegisterPush

    Unregister the offline push service when logging out of the IM account.
    Note:
    You need to log in using the login interface provided by TUILogin in the TUICore component, and the plugin will automatically perceive and register the push service.
    If you don't want to use the interface provided by TUILogin, after completing the login operation, you need to manually call this interface to register the service.
    Usage: [TIMPush unRegisterPush];

    + (void)disableAutoRegisterPush

    To turn off the plugin's automatic registration of the push service, you need to call this before logging in.
    Note:
    If you log in using the login interface provided by TUILogin in the TUICore component, the plugin automatically registers the push service by default. Calling this interface will turn off automatic registration.
    Usage: [TIMPush disableAutoRegisterPush];

    + (void)onReceiveNotificationRequest:(UNNotificationRequest *)request inAppGroupID:(NSString *)appGroupID callback:(TIMPushNotificationExtensionCallback)callback

    Statistics on the push arrival rate of TIMPush
    You need to implement the `- applicationGroupID` method in the AppDelegate.m file, returning the App Group ID.
    And call this function in the Notification Service Extension's '- didReceiveNotificationRequest:withContentHandler:' method.
    Note:
    The appGroup identifier represents the App Group shared between the main App and its Extension. It needs to be configured in the main App's Capability as App Groups.
    Parameter description:
    request
    appGroupID
    The appGroup identifier represents the App Group shared between the main App and its Extension. It needs to be configured in the main App's Capability as App Groups.
    callback
    typedef void(^TIMPushNotificationExtensionCallback)(UNNotificationContent *content) Statistical function Callback, carrying content information
    Usage:
    
    - (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
    self.contentHandler = contentHandler;
    NSString * appGroupID = kTIMPushAppGorupKey;
    __weak typeof(self) weakSelf = self;
    [TIMPush onReceiveNotificationRequest:request inAppGroupID: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);
    }];
    }
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support