tencent cloud

Feedback

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

    TIMPushManager

    public abstract class TIMPushManager: Push Plugin Interface Class.

    API overview

    Register/Unregister Push Service Interface

    After initializing and successfully logging in to IM, you can register for push services.
    API
    Description
    To register for push services, read the configuration file timpush-configs.json from the project.
    Register for push services, with push information coming from the interface parameters in JSON.
    Unregister to close offline push services, call before logging out of the IM account.
    To disable the plugin from automatically registering for push services after logging in, call before registering for push services.

    FCM Custom Ringtone Configuration Interface

    Once configured, the custom ringtone is effective. The sender must include the channelId in the offline message sent.
    API
    Description
    To configure FCM's custom ringtone, it needs to be called before registering for push services.
    The custom replacement plugin by default reads the push service registration configuration file timpush-configs.json, which needs to be called before registering for push services

    Push Channel Special Configuration Interface

    API
    Description
    Specify the manufacturer channel type to be used for device offline push, which needs to be called before registering for push services.
    Get the manufacturer channel type currently used for device offline push.
    After completing the access configuration for various manufacturers, this interface can be used to test the push status on the corresponding manufacturers' devices.

    Interface Details

    Static Public Member Functions

    static TIMPushManager getInstance(): Retrieves the TIMPushManager manager instance.

    Member Function Description

    abstract void registerPush(Context context, TIMPushCallback callback)

    Register offline push service, call upon successful login to the IM account. (To facilitate the easiest possible integration into the push service, the plugin will automatically read the configuration file timpush-configs.json in the project to obtain the information needed to register for the push service)
    Note:
    You need to use the login API provided by TUILogin of the TUICore component to log in; the plugin will automatically detect this and register the push service.
    If you do not wish to use the API provided by TUILogin, you need to manually call this interface to register the service after completing the login operation.

    abstract void registerPush(String json, Context context, TIMPushCallback callback)

    Register offline push service, call upon successful login to the IM account. (Information needed for registering push service comes from the interface parameters in JSON)
    Parameters JSON:
    {
    // huawei
    "huaweiPushBussinessId": "",
    // Certificate ID generated after uploading a third-party push certificate in the IM console
    "huaweiBadgeClassName": "", // Subscript parameter, defaults to the class name of the application's launcher interface
    // xiaomi
    "xiaomiPushBussinessId": "",// Certificate ID generated after uploading a third-party push certificate in the Tencent Cloud Console
    "xiaomiPushAppId": "",// Application APPID assigned by Xiaomi Open Platform "xiaomiPushAppKey": "",// APPKEY assigned by Xiaomi Open Platform
    // meizu
    "meizuPushBussinessId": "", // Certificate ID generated after uploading a third-party push certificate in the Tencent Cloud Console
    "meizuPushAppId": "",// Application APPID assigned by Meizu Open Platform "meizuPushAppKey": "",// APPKEY assigned by Meizu Open Platform
    // vivo
    "vivoPushBussinessId": "", // Certificate ID generated after uploading a third-party push certificate in the Tencent Cloud Console
    // google
    "fcmPushBussinessId": "", // Certificate ID generated after uploading a third-party push certificate in the Tencent Cloud Console
    // oppo
    "oppoPushBussinessId": "", // Certificate ID generated after uploading a third-party push certificate in the Tencent Cloud Console
    "oppoPushAppKey": "",// AppKey assigned by the OPPO Open Platform
    "oppoPushAppSecret": "",// AppSecret assigned by the OPPO Open Platform
    // honor
    "honorPushBussinessId": "", // Certificate ID assigned after uploading a third-party push certificate in the Tencent Cloud Console
    }

    abstract void unRegisterPush(TIMPushCallback callback)

    Unregister to close offline push services, call before logging out of the IM account.
    Note:
    If you do not wish to use the push service, you can manually call this interface to unregister the service.
    If you log out using the logout API provided by TUILogin of the TUICore component, the plugin will automatically detect this and unregister the push service.

    abstract void disableAutoRegisterPush()

    To disable the plugin from automatically registering for the push service, it's necessary to call this before logging in.
    Note:
    If you log in using the login API provided by TUILogin in the TUICore component, the plugin will by default automatically register for the push service. Calling this interface can disable the automatic registration.

    abstract void configFCMPrivateRing(String channelId, String ringName, boolean enable)

    To configure FCM's custom ringtone, it needs to be called before registering for push services.
    Note:
    Once configured, the custom ringtone is effective. The sender must include the channelId in the offline message sent.
    Parameter description:
    API
    Description
    channelId
    FCM channel uniquely defines the channel ID of the notification bar within the app.
    ringName
    FCM channel defines the name of the push ringtone for the notification bar, located in the raw directory and does not require a file suffix.
    enable
    Set whether the offline push prompt ringtone uses a custom ringtone.

    abstract void setCustomTIMPushConfigs(String configs)

    The custom replacement plugin by default reads the push service registration configuration file timpush-configs.json, which needs to be called before registering for push services.
    Note:
    Mainly used for dynamically switching different configuration files for push registration in multiple environments, for example: push feature integration and testing under different configuration files in production and test environments;
    For methods to switch during the static compilation period, please refer to: buildConfigField("String", "custom_timpush_configs", "\\"Custom Definition File Name\\"")
    Parameter description:
    Parameter
    Description
    configs
    The name of the custom Definition configuration file should remain unchanged: "Engineering Root Directory/app/src/assets/"

    abstract void setPushChannel(int channelId)

    Specify the manufacturer channel type to be used for device offline push, which needs to be called before registering for push services.
    Note:
    This interface can specify the use of manufacturer push channel types, for example, specifying the use of the FCM channel for Xiaomi devices abroad with setPushChannel(2002).
    Generally, the channel type is not specified; the component will automatically identify the device manufacturer category to register and use the corresponding manufacturer channel.
    Parameter description:
    Parameter
    Description
    channelId
    Vendor
    Device Type
    XiaoMi
    2000
    HuaWei
    2001
    FCM
    2002
    Meizu
    2003
    Oppo
    2004
    Vivo
    2005
    Honor
    2006

    static TIMPushManager getPushChannel()

    Get the manufacturer channel type currently used for device offline push.

    abstract void checkPushStatus(int brandId, TIMPushCallback<String> callback)

    After the access configuration for each manufacturer is completed, this interface can be used to test whether the corresponding manufacturer's equipment can receive pushes.
    Parameter description:
    Parameter
    Description
    callback
    true indicates that the configuration was successful and can push.
    
    
    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