05/15/2024 15:19:45

TPNS channel description-Tencent Cloud paid version

TPNS notification: To avoid a Huawei vendor TPNS push exception, the access party must upgrade MSDK version to MSDK5.13 (TPNS1.2.0.4) or above before June 30, 2021.

This documentation is applicable to MSDKV5.10 and later versions (MSDK TPNS Tencent Cloud paid version), which is different from the free version of XG. Tencent Cloud version and the free version are not compatible with each other. After upgrading, you need to re-apply for the accessId and accessKey of Tencent Mobile Push. MSDKV5 client has integrated Tencent Mobile Push Tencent Cloud version since V5.10 version. Currently, Tencent Cloud version supports pluginization access, but it is no longer compatible with the old version of XG.

Starting from MSDKV5.10, this has been implemented, so as to distinguish the new version from V5.9 and lower versions and to adapt to the features of Tencent Cloud version of Tencent Mobile Push. If you need to do a single push operation, please pay attention to the value of the xgTpnsToken field in the callback and use it for single push operation.

I. Developer Platform Configuration

I. Developer Platform Configuration

1.1 Create a product

Log in XG Tencent Cloud Page, and then select [New Product] to create an app. For details, please refer to Tencent Mobile Push-Documentation for Creating Product and Application.

1.2 Creation a push task as well as the push test method

As for details about the creation of a push task as well as the push test method, please refer to Tencent Mobile Push-Creating Push Task as well as Push Test Method documentation.

1.3 Introduction to Tencent Mobile Push Service Payment

As for details about the Introduction to Tencent Mobile Push Service Payment, please refer to Tencent Mobile Push-Product Pricing Documentation.

MSDK Support: MSDK assistant/happyjchen/jiaganzheng

Tencent Mobile Push Side Support: ablecao

[Info]Precaution:

  1. Since July 1, 2020, clusters with less than 1000 networked devices enjoy free trial and don't need to apply for a trial, so as to facilitate them to experience and test the push at any time.
  2. Before August 3, 2020, if a cluster with more than 1000 daily networked devices during the trial period, it will receive an overload alarm. If you do not activate the post-pay billing function, the push will be lost probably.
  3. Starting from August 3, 2020, the overload-triggered service suspension mechanism will be officially launched, which is a mechanism that suspend services for apps with excessive users in the free trial period. If your app has already increased users at large scale, please activate the post-pay billing function in advance to avoid service suspension due to overload.
  4. For internal customers, it is recommend to activate the pay-as-you-go billing function (post-pay) and activate the privilege of not suspending service even in arrears, that is: being in arrears does not affect the push service (precaution: It is needed to use Tencent Cloud's internal account to activate the post-pay function).
    For example: For an app whose service version is the experience version, the push service will be suspended once the number of its daily networked devices exceeds 1000. The service will be restored immediately after it pays the fee (note: device registration, account and tag binding services are not affected).

1.4 Vendor channel arrival receipt configuration

The support for receipt of arriving data varies by vendor in China. The channel arrival data of Huawei, Meizu cannot be obtained directly, and developers need to manually configure the corresponding configuration. For details, please refer to Tencent Push Notification Service - Guide for Obtaining the Arrival Receipts of Vendor Channels

II. Domain name of each service access point of Tencent Mobile Push Tencent Cloud version

II. Domain name of each service access point of Tencent Mobile Push Tencent Cloud version

The interface request address corresponds to the service access point one by one. Please select the request address corresponding to your app's service access point.

For MSDK5.13 and earlier versions, use the following domain names:

Cluster name Registration host Statistics host Port
Guangzhou https://api.tpns.tencent.com https://stat.tpns.tencent.com 0
Shanghai https://api.tpns.sh.tencent.com https://stat.tpns.sh.tencent.com 0
Hong Kong https://api.tpns.hk.tencent.com https://stat.tpns.hk.tencent.com 0
Singapore https://api.tpns.sgp.tencent.com https://stat.tpns.sgp.tencent.com 0

For MSDK 5.15 and later versions, use the following domain names (note that the 'https://' prefix is not required):

Cluster name host (registration and statistics are not distinguished)
Guangzhou tpns.tencent.com
Shanghai tpns.sh.tencent.com
Hong Kong tpns.hk.tencent.com
Singapore tpns.sgp.tencent.com

If the above configuration is not made, TPNS SDK will connect to the Guangzhou cluster by default (currently the newly-applied apps are defaulted as the Shanghai cluster in the console, so the console data does not match SDK's default cluster and the push is problematic)

How to confirm the cluster of an app?

After logging into TPNS Tencent Cloud Page , you can see the corresponding cluster of your app

console-xg-push-group

III. Android project configuration

III. Android project configuration

3.1 AndroidManifest.xml configuration

<application>
    <!-- Other configurations of App -->
    <uses-library android:name="org.apache.http.legacy" android:required="false"/>
    <!-- [Required] Tencent Mobile Push's default notification -->
    <activity
        android:name="com.tencent.android.tpush.TpnsActivity">
        android:exported="true"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" >
        <intent-filter>
            <!-- [Required] [Warning] ${applicationId} is modified to correspond to the current APP package name -->
            <data
                android:host="${applicationId}"
                android:scheme="tpns" />

            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

    <!-- MSDK 5.30.001 removes the following two nodes -->
    <!-- The following two nodes are used for overriding because the Oppo channel package is not compatible with Target API 31-->
    <service
        android:name="com.heytap.mcssdk.PushService"
        android:exported="true"
        android:permission="com.coloros.mcs.permission.SEND_MCS_MESSAGE"
        tools:node="replace" >
        <intent-filter>
            <action android:name="com.coloros.mcs.action.RECEIVE_MCS_MESSAGE" />
        </intent-filter>
    </service>
    <service
        android:name="com.heytap.mcssdk.AppPushService"
        android:exported="true"
        android:permission="com.heytap.mcs.permission.SEND_MCS_MESSAGE"
        tools:node="replace" >
        <intent-filter>
            <action android:name="com.heytap.mcs.action.RECEIVE_MCS_MESSAGE" />
        </intent-filter>
    </service>
    <!-- MSDK 5.30.001 removes the above two nodes -->
    <!-- MSDK 5.30.001 adds the following two nodes -->
    <service
        android:name="com.heytap.msp.push.service.CompatibleDataMessageCallbackService"
        android:permission="com.coloros.mcs.permission.SEND_MCS_MESSAGE">
        <intent-filter>
            <action android:name="com.coloros.mcs.action.RECEIVE_MCS_MESSAGE"/>
        </intent-filter>
        </service>
        <service
        android:name="com.heytap.msp.push.service.DataMessageCallbackService"
        android:permission="com.heytap.mcs.permission.SEND_PUSH_MESSAGE">
        <intent-filter>
            <action android:name="com.heytap.mcs.action.RECEIVE_MCS_MESSAGE"/>
            <action android:name="com.heytap.msp.push.RECEIVE_MCS_MESSAGE"/>
        </intent-filter>
    </service>
    <!-- MSDK 5.30.001 added the above two nodes -->

    <!-- [Warning] InnerTpnsActivity configuration has been added since MSDKV5.22.000 (TPNS Android 1.3.1.1), where ${applicationId} is replaced with "application package name" -->    
    <activity
        android:name="com.tencent.android.tpush.InnerTpnsActivity"
        android:exported="false"
        android:launchMode="singleInstance"
        android:theme="@android:style/Theme.Translucent.NoTitleBar">
        <intent-filter>
        <!-- [Required] [Warning] Please modify it to the current APP package name. OPEN_TPNS_ACTIVITY_V2 -->
            <action android:name="${applicationId}.OPEN_TPNS_ACTIVITY_V2" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <intent-filter>
        <!-- [Required] [Warning] ${applicationId} is modified to correspond to the current APP package name -->
            <data
                android:host="${applicationId}"
                android:scheme="stpns" />

            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action" />
        </intent-filter>
    </activity>
    <!-- [Warning] InnerTpnsActivity configuration has been added since MSDKV5.22.000 (TPNS Android 1.3.1.1), where ${applicationId} is replaced with "application package name" -->

    <!-- [Required] Tencent Mobile Push receiver broadcast receiver, starting from MSDKV5.22.000 (TPNS Android 1.3.1.1), the configuration of XGPushReceiver is as follows -->
    <receiver
        android:name="com.tencent.android.tpush.XGPushReceiver"
        android:exported="false"
        android:process=":xg_vip_service">

        <intent-filter android:priority="0x7fffffff">

            <!-- [Required] Internal broadcast of TPNS SDK -->
            <action android:name="com.tencent.android.xg.vip.action.SDK" />
            <action android:name="com.tencent.android.xg.vip.action.INTERNAL_PUSH_MESSAGE" />
            <action android:name="com.tencent.android.xg.vip.action.ACTION_SDK_KEEPALIVE" />
        </intent-filter>

    </receiver>

    <!-- [Required] TPNS receiver. The configuration of XGPushReceiver before MSDKV5.22.000 (TPNS Android 1.3.1.1) is as follows -->    
    <receiver
        android:name="com.tencent.android.tpush.XGPushReceiver"
        android:process=":xg_vip_service">
        <intent-filter android:priority="0x7fffffff">
            <!-- [Required] Tencent Mobile Push SDK's internal broadcast -->
            <action android:name="com.tencent.android.xg.vip.action.SDK" />
            <action android:name="com.tencent.android.xg.vip.action.INTERNAL_PUSH_MESSAGE" />
            <action android:name="com.tencent.android.xg.vip.action.ACTION_SDK_KEEPALIVE" />
        </intent-filter>
    </receiver>

    <!-- [Required] Tencent Mobile Push service -->
    <service
        android:name="com.tencent.android.tpush.service.XGVipPushService"
        android:persistent="true"
        android:process=":xg_vip_service"></service>

    <!-- [Required] Notification service, where android:name part should be changed to the current package name -->
    <service android:name="com.tencent.android.tpush.rpc.XGRemoteService"
        android:exported="false">
        <intent-filter>
            <!-- [Required] Please modify the name to the current APP package name.XGVIP_PUSH_ACTION -->
            <action android:name="${applicationId}.XGVIP_PUSH_ACTION" />
        </intent-filter>
    </service>

    <!-- [Required] [Precaution] authorities are modified to the package name.XGVIP_PUSH_AUTH -->
    <provider
        android:name="com.tencent.android.tpush.XGPushProvider"
        android:authorities="${applicationId}.XGVIP_PUSH_AUTH"         android:enabled="false"
        android:exported="false"
        tools:replace="android:authorities" />

    <!-- [Required] [Precaution] authorities are modified to the package name.TPUSH_PROVIDER -->
    <provider
        android:name="com.tencent.android.tpush.SettingsContentProvider"
        android:authorities="${applicationId}.TPUSH_PROVIDER" />

    <!-- [Optional] Used to enhance the survival capability -->
    <provider
        android:name="com.tencent.android.tpush.XGVipPushKAProvider"
        android:authorities="${applicationId}.AUTH_XGPUSH_KEEPALIVE"
        android:exported="true" />

    <!-- [Optional] Receiver implemented by APP is used to receive the  message transparent transmission and the callback of the operation result. Please add it as needed -->
    <!-- YOUR_PACKAGE_PATH.CustomPushReceiver needs to be changed to your own Receiver: -->
    <receiver
        android:name="com.tencent.gcloud.msdk.push.MSDKXGPushReceiver"
        android:exported="false">
        <intent-filter>
            <!-- Receive the message transparent transmission -->
            <action android:name="com.tencent.android.xg.vip.action.PUSH_MESSAGE" />
            <!-- Monitor registration, de-register, set/delete tags, and notify the user of being clicked and other processing results -->
            <action android:name="com.tencent.android.xg.vip.action.FEEDBACK" />
        </intent-filter>
    </receiver>

    <!-- MQTT START-->
    <service android:exported="false"
        android:process=":xg_vip_service"
        android:name="com.tencent.bigdata.mqttchannel.services.MqttService" />

    <!--[Precaution] authorities are modified to the package name.XG_SETTINGS_PROVIDER; for example, the demo's package name is: com.tencent.android.xg.cloud.demo -->
    <provider
        android:exported="false"
        android:name="com.tencent.tpns.baseapi.base.SettingsContentProvider"
        android:authorities="${applicationId}.XG_SETTINGS_PROVIDER" />

    <!-- MQTT END-->
    <!--XG_V2_ACCESS_ID and XG_V2_ACCESS_KEY have been integrated into the configuration of the MSDKConfig.ini file -->

    <!-- vivo manufacturer channel configuration -->
    <!--        <meta-data-->
    <!--            android:name="com.vivo.push.app_id"-->
    <!--            android:value="@string/vivo_app_id" />-->
    <!--        <meta-data-->
    <!--            android:name="com.vivo.push.api_key"-->
    <!--            android:value="@string/vivo_app_key" />-->

    <!--  Other Android components -->

    <!-- Access point configuration: If your application service access point is the Guangzhou cluster, SDK implements this configuration by default. -->
    <!-- If your application service access point is Shanghai, Singapore or Hong Kong, please follow the steps below to complete the domain name configuration for other service access points. Otherwise, this will cause the registration push service to fail and return `-502` or `1008003` error code. -->
    <meta-data
           android:name="XG_SERVER_SUFFIX"
           android:value="Domain name of other service access points"/>
    <!-- The domain names of other service access points are as follows: -->
    <!-- Shanghai: tpns.sh.tensint.com -->
    <!-- Singapore: tpns.sgp.tensint.com -->
    <!-- Hong Kong, China: tpns.hk.tentent.com -->

    <!-- <meta-data -->
    <!-- android:name="XG_GUID_SERVER" -->
    <!-- android:value="${XG_GUID_SERVER}" /> -->
    <!-- <meta-data -->
    <!-- android:name="XG_STAT_SERVER" -->
    <!-- android:value="${XG_STAT_SERVER}" /> -->
    <!-- <meta-data -->
    <!-- android:name="XG_LOG_SERVER" -->
    <!-- android:value="${XG_LOG_SERVER}" /> -->   

    <!-- If the following configuration is not made, duplicate message may appear when the message is pushed simultaneously on [old version of XG] and [Tencent Mobile Push] platforms.
If your app determines to no longer use [old version of XG] for pushing messages, you can ignore the configuration. -->
    <meta-data
        android:name="XG_OLD_ACCESS_ID"
        android:value="xxxxxxxxx" />

    <!-- huawei appid configuration-->
    <meta-data tools:replace="android:value"
        android:name="com.huawei.hms.client.appid"
        android:value="{HUAWEI_APPID}" />

</application>

<!-- [Required] Permission required by Tencent Mobile Push SDK5.0 version -->
<permission
    android:name="${applicationId}.permission.XGPUSH_RECEIVE"
    android:protectionLevel="signature" />
<uses-permission android:name="${applicationId}.permission.XGPUSH_RECEIVE" />

<!-- [Required] Permission required by Tencent Mobile Push SDK -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

<!-- [Commonly Used]  Permission required by Tencent Mobile Push SDK -->
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" /> <!-- Huawei-defined permissions -->
<uses-permission android:name="com.vivo.notification.permission.BADGE_ICON" /> <!-- VIVO-defined permissions -->
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RESTART_PACKAGES" />
<uses-permission android:name="android.permission.GET_TASKS" />

[Info] Compilation without using Gradle, ${applicationId} needs to be replaced with the package name of the game

3.2 Channel information configuration

In the project's assets/MSDKConfig.ini file, add the following configuration

[TPNS debugging configuration ]
MSDK_DEBUG = 1
MSDK_DEBUG_CHANNEL = XG
[TPNS channel configuration ]
# Tencent Mobile Push's access point needs to be replaced with the corresponding access point of your app. If you delete this configuration, TPNS SDK will use Guangzhou access point by default
XG_HOST = tpns.sh.tencent.com
# The following three configurations are only required in MSDK5.13 and earlier versions
XG_PORT = 0
XG_STAT_HOST = https://stat.tpns.sh.tencent.com
XG_STAT_PORT = 0
# The above three configurations are only required in MSDK5.13 and earlier versions
# TPNS Android AccessId AccessKey configuration 
XG_ACCESS_ID_ANDROID = {YOUR_XG_ACCESS_ID}
XG_ACCESS_KEY_ANDROID = {YOUR_XG_ACCESS_KEY}
# Does TPNS enable manufacturer channel? 
XG_OTHER_ENABLE = 1
# TPNS XIAOMI manufacturer channel configuration 
XG_XIAOMI_ENABLE = 1
XG_XIAOMI_APP_ID = {YOUR_XG_XIAOMI_APP_ID}
XG_XIAOMI_APP_KEY = {YOUR_XG_XIAOMI_APP_KEY}
# TPNS HUAWEI manufacturer channel configuration 
XG_HUAWEI_ENABLE = 1
# TPNS FLYME manufacturer channel configuration 
XG_FLYME_ENABLE = 1
XG_FLYME_APP_ID = {YOUR_XG_FLYME_APP_ID}
XG_FLYME_APP_KEY = {YOUR_XG_FLYME_APP_KEY}
# TPNS OPPO vendor channel configuration
XG_OPPO_ENABLE = 1 
# Warning: note that OPPO's `AppKey` is entered here rather than the `AppId`
XG_OPPO_APP_ID = {YOUR_XG_OPPO_APP_KEY}
# Warning: Note that OPPO's `AppSecret` is entered here rather than the `AppKey
XG_OPPO_APP_KEY = {YOUR_XG_OPPO_APP_SECRET}

[Info]Precaution:

  1. {MSDK_DEBUG} 1 means to enable the debug mode, 0 means to disable the debug mode
  2. {MSDK_DEBUG_CHANNEL} This switch is set to XG, which means to enable XG debugging. This switch takes effect only when {MSDK_DEBUG} is 1. They are in the same configuration file
  3. After the Tencent Cloud version is upgraded, it supports the vendor channels of Huawei, Xiaomi, Meizu and OPPO. The game needs to apply for the app id and app key of each channel by itself, and then fill in the corresponding results in the management terminal and client ini configuration of the Tencent Cloud version of Tencent Push Notification Service. The requirements for opening the push channels of different vendors are inconsistent. The following vendors require developers to additionally configure them on the vendors’ open platforms:
    For the opening steps of Huawei push channel, please refer to Tencent Push Notification Service - Configure Applications on Huawei Push Platform
    To open the Xiaomi push channel, you need to open the application message push service on the Xiaomi open platform. For details, refer to Tencent Push Notification Service - Xiaomi Channel Access Steps
  4. In Tencent Mobile Push access point configuration, Guangzhou's domain name is https: //api.tpns.tencent.com.
  5. In MSDK 5.15 and later versions, TPNS access domain name has been changed. Please refer to TPNS access point domain name. Delete three configurations at the same time: XG_PORT, XG_STAT_HOST, and XG_STAT_PORT
  6. Since MSDK 5.23.002, MSDK has removed Huawei, Xiaomi and vivo manufacturer channels; since MSDK 5.23.003, MSDK has removed Meizu manufacturer channel.
  7. Since MSDK 5.30.000, vendor push channels have been restored.
IV. iOS project configuration

IV. iOS project configuration

4.1 Xcode project configuration file info.plist

Enable push in the project configuration and the backend mode, as shown in the figure below.

信鸽工程配置

4.2 System library dependency

  • XGMTACloud.framework
  • CoreTelephony.framework
  • SystemConfiguration.framework
  • UserNotifications.framework (Status 修改为: Optional)
  • UserNotifications.framework (status is changed to: Optional)
  • libXG-SDK-Cloud.a
  • libz.tbd
  • CoreData.framework
  • CFNetwork.framework
  • libc++.tbd

4.3 Channel information configuration

# TPNS iOS AccessId AccessKey configuration 
XG_ACCESS_ID_IOS = {YOUR_XG_ACCESS_ID}
XG_ACCESS_KEY_IOS = {YOUR_XG_ACCESS_KEY}
# In MSDK 5.13 version, the Shanghai cluster needs to change XG_HOST to https://api.tpns.sh.tencent.com
# Since MSDK 5.15 version, TPNS access point needs to be replaced with the corresponding  access point of your app. If you delete this configuration, TPNS SDK will use Guangzhou access point by default
XG_HOST = tpns.sh.tencent.com
# Only in MSDK5.13 and earlier versions, the following three ("XG_PORT", "XG_STAT_HOST", "XG_STAT_PORT") configurations are required
# If the following configuration is not made, duplicate message may appear when the message is pushed simultaneously on [old version of XG] and [Tencent Mobile Push] platforms.
# If your app determines to no longer use [old version of XG] for pushing messages, you can ignore the configuration. -->
XG_PORT = 0
XG_STAT_HOST = https://stat.tpns.sh.tencent.com
XG_STAT_PORT = 0
# If you use MSDK5.18 and later versions, you can ignore the "XG_FREE_ACCESS_ID_IOS" configuration
XG_FREE_ACCESS_ID_IOS = {YOUR_OLD_XG_ACCESS_ID_IOS}
# TPNS iOS front-end push switch, disabled by default
XG_SHOW_FOREGROUND_ALERT = 0

[Info]Precaution:
1.In MSDK 5.15 and later versions, TPNS access domain name has been changed. Please refer to TPNS access point domain name. Delete the three configurations at the same time: XG_PORT, XG_STAT_HOST, and XG_STAT_PORT

2.As for Tencent Mobile Push access point configuration in MSDK 5.13 version, Guangzhou domain name is https://api.tpns.tencent.com. The Shanghai cluster needs to change XG_HOST to https://api.tpns.sh.tencent.com.

4.4 Notification service extension plugin configuration (count plugins required for arrival)

[info] MSDK only carries the TPNS extension library. Games are required to integrate and access the library. For specific access ways, please refer to the TPNS guide documentation: Instructions on How to Use Notification Service Extension. Contact person: Cloud IT support.

1) Introduction

In order to accurately count the arrival rate of messages and receive rich media messages, SDK provides a Service Extension interface which can be called by the client, so that it can monitor the arrival of messages and receive rich media messages. You can use this function according to the following instructions.

The statistical effect of integrating this plugin:

The statistical effect of not integrating this plugin:

2) TPNS statistical reporting interface

Report push message receipts. The purpose of this interface is to count whether the push message arrives at the terminal.

/**
@Brief Tencent Mobile Push handles the message that arrives at the terminal, that is, the message receipt

@Param request Push request
@Param appID Tencent Mobile Push application ID
@Param appKey Tencent Mobile Push application Key
@Param handler Handle the callback of the message, and handle the associated rich media file in the callback method
 */
- (void)handleNotificationRequest:(nonnull UNNotificationRequest *)request appID:(uint32_t)appID appKey:(nonnull NSString *)appKey contentHandler:(nullable void(^)( NSArray <UNNotificationAttachment *>* _Nullable attachments,  NSError * _Nullable error))handler;

3) Parameter Description

  • request: Push request .
  • appID: Tencent Mobile Push app ID
  • handler: Handle the message receipt, and handle the associated rich media file in the callback method.

4) Use description

In order to use the extension SDK, the operating steps are as follows:

Create a notification extension Target:

(1)In the XCode menu bar, select File> New> Target.

(2)Enter the Target page, select Notification Service Extension, and then click [Next].

(3)Enter the Product Name and click [Finish].

(4)Configure Target, add dependency library files: libXGExtension.a, libz.tbd, libsqlite3.tbd.

(5)Call the TPNS statistical reporting interface. Demo code is as follows:

Note: If your app does not belong to Guangzhou cluster, please configure the statistical domain name of the corresponding cluster according to the demo code.

- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
    self.contentHandler = contentHandler;
    self.bestAttemptContent = [request.content mutableCopy];
    ///Shanghai cluster domain name configuration 
    //[XGExtension defaultManager].reportHost = @"https://stat.tpns.sh.tencent.com";
    ///Hong Kong cluster domain name configuration 
    //[XGExtension defaultManager].reportHost = @"https://stat.tpns.hk.tencent.com";
    /// Singapore cluster domain name configuration 
    //[XGExtension defaultManager].reportHost = @"https://stat.tpns.sgp.tencent.com";
    [[XGExtension defaultManager] handleNotificationRequest:request appID:<#appid#> appKey:<#appkey#>  contentHandler:^(NSArray<UNNotificationAttachment *> * _Nullable attachments, NSError * _Nullable error) {
        self.bestAttemptContent.attachments = attachments;
        self.contentHandler(self.bestAttemptContent);
    }];
}
V. Frequently Asked Questions

V. Frequently Asked Questions

5.1 MSDK Tencent Mobile Push exception troubleshooting steps

  1. Check AccessID and AccessKey configuration (MSDKConfig.ini file )
  2. Check iOS certificate configuration or Android configuration
  3. Don't make installation test after re-signing
  4. Confirm whether the test passes Tencent Mobile Push console or the server calls Tencent Mobile Push interface test
  5. To make joint debugging in Xcode 8 & iOS 10, it is needed to enable Push Capability
  6. Call the MSDKPush interface instead of the native interface of XGPush to register push

5.2 At overseas access points, Xiaomi manufacturer channel's push messages cannot be received

According to the response of Tencent Mobile Push side, at overseas access points, in order to meet data compliance, it is needed to use Xiaomi devices issued overseas for testing. The domestically issued Xiaomi device can only receive the push at the domestic access point. For details, please consult @ XG Push Assistant.

5.3 In case of registration under iOS, an error like the failure of APNS to request token will be reported, resulting in the termination of the operation

This problem is caused by the instability of the APNs service. You can try to solve it with the following ways:

  1. Use the 4G network to test it after inserting the SIM card into the mobile phone.
  2. Uninstall and reinstall App, and then restart App. Test it after shutting down the machine and restarting App.
  3. Make a package test in the production environment.
  4. Change to use another mobile phone installed with iOS 13 system for test

For details, please refer to: In the iOS13 development environment, DeviceToken is not returned occasionally after registration?

5.4 In UE4.23 and above, it will be reported that minSdkVersion is set to be too small when Android APK is compiled

  1. MSDKXG upgraded the library dependencies of Huawei vendor channel in V5.12

  2. The following configuration has been added to the AndroidManifest.xml file of MSDKXG to solve this problem

         <uses-sdk tools:overrideLibrary="com.huawei.hmf.tasks,
                                         com.huawei.android.hms.push,
                                         com.huawei.android.hms.openid,
                                         com.huawei.android.hms.base,
                                         com.huawei.hms.base.availableupdate,
                                         com.huawei.hms.stats,
                                         com.huawei.hms.base.ui,
                                         com.huawei.hms.base.device,
                                         com.huawei.hms.log,
                                         com.huawei.agconnect.core"/>
    
  3. But this configuration cannot be recognized in UE4.23. The game can manually add configuration in the AndroidManifest.xml or APL.xml file in the root directory of the project to solve this problem. The APL file's reference example is as follows (the following configuration includes the dependency of Huawei login channel):
         <androidManifestUpdates>
             <addElements tag="manifest">
                 <uses-sdk tools:overrideLibrary="com.huawei.hmf.tasks,com.huawei.android.hms.hwid,com.huawei.android.hms.base,com.huawei.hms.base.availableupdate,com.huawei.hms.stats,com.huawei.hms.base.ui,com.huawei.hms.base.device,com.huawei.hms.log,com.huawei.agconnect.core,com.huawei.android.hms.push,com.huawei.android.hms.openid" tools:ignore="MultipleUsesSdk" xmlns:tools="http://schemas.android.com/tools"/>
             </addElements>
         </androidManifestUpdates>
    

5.5 iOS initialization registration only has a callback when it is called for the first time. After the registration is successful, there will be no callback when it is called again.

Since MSDK5.13 version (including 5.13 version)
public static void RegisterPush(string channel, string account="")

Register the Push interface. In XG channel, there is a callback only when XG is called for the first time; there will be no callback when it is called again later. The above is the design logic of Tencent Mobile Push -SDK. MSDK currently handle the push issue according to Tencent Mobile Push recommendations

5.6 Calling the RegisterPush interface reports an error: "Huawei class not found, agconnect-services.json"

xg_huawei_json

  1. In V5.15 version, MSDKXG upgrades the SDK of Huawei vendor channel to V5 version. The Huawei vendor channel of this version needs to add Huawei Push configuration file
  2. The agconnect-services.json file needs to be added to the project's 'assets' directory to solve this problem From [Huawei open platform] (https: //developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/android-integrating-sdk-0000001050040084), enter [My Project]> Select Project> [Project Settings], download the latest 'agconnect-services.json' configuration file of Huawei App and copy it to the project's 'assets' directory.

    xg_huawei_json

5.7 TPNS SDK "Get Application Installation List" problem

The "Get Application Installation List" problem is fixed in version 1.2.6.0 of TPNS SDK

Currently, this problem can be circumvented by adding the following two nodes in the AndroidManifest.xml file:

<provider
        tools:node="replace"
        android:name="com.tencent.android.tpush.XGPushProvider"
        android:authorities="${applicationId}.XGVIP_PUSH_AUTH"
        android:exported="false"
        android:enabled="false"/>

<meta-data
        android:name="XG_SERVICE_PULL_UP_OFF"
        android:value="true" />



Copyright © 2024 MSDK.
All rights reserved.

results matching ""

    No results matching ""