Message push
Unity3D
Outline
Access Guide
TPNS push
Send push message
Add local push
Tag push
Vendor Channel Push
FAQ
Android
Outline
Access Guide
TPNS push
Send push message
Add local push
Tag push
Vendor Channel Push
FAQ
IOS
Outline
Access Guide
TPNS push
Send push message
Add local push
Tag push
FAQ
Others
Data Structure
System Tools
Message push / Android / Outline

Outline

The push function can push game-related information to the player's phone in case that the game is not running, such as a variety of holiday activities, anniversary activities. The push effect is shown in the following diagram:

Access Guide

Preconditions

1)You have complete Access Configuration according to the description of MSDK Android Access Configuration Module. Ensure the push switch PUSH=true.

Tencent Mobile Push TPNS

TPNS is the charged version. If you want to access it, you need to apply for the accessId and accessKey again. MSDKV3 client has started to integrate TPNS since Version 3.3.12. Currently, TPNS supports pluginized access.

Important: To avoid Huawei vendor channel push exceptions, the access party must upgrade the MSDK version to MSDK3.3.16 (TPNS 1.2.0.4) or above before June 30, 2021.

1 Apply accessId and accessKey

accessId and accessKey can be directly applied for at Feiying System (Intranet access). Please contact MSDK Assistant to assist in registration

If the game has already registered a Tencent Cloud account in the Tencent Cloud console and already has a Cloud XG account, it can also be migrated to Feiying System. You need to contact MSDK Assistant to assist in migration

  • To register and apply in the Feiying system or to migrate to the Feiying system, you need to provide UIN (you can log into the Tencent Cloud's official website to view the UIN: https://console.cloud.tencent.com/developer
  • Internal users of the company can use Tencent Cloud's internal account to purchase it. As for the company's internal account query method and application method, please see https://docs.qq.com/doc/DVWZBYkJ2SHBaUE9y

2 Client access instructions

Starting from MSDK3.3.18 version, Tencent Mobile Push has been separated into TPNSSDK and HWPushSDK plugins.

  • TPNSSDK: Tencent Mobile Push and vendor channel push (MEIZU, VIVO, OPPO, XIAOMI)
  • HWPushSDK: Huawei vendor channel push

If you need to access TPNSSDK and HWPushSDK plugins, you can directly copy TPNSSDK and HWPushSDK plugins compeletly to the same level directory as that of MSDKLibrary and add the following references in build.gradle and settings.gradle (same level as MSDKLibrary); otherwise, delete the references and plugins.

compile project(':TPNSSDK')
compile project(':HWPushSDK')
include ':HWPushSDK'
include ':TPNSSDK'

Note:

  • Starting from the MSDK3.3.18 version, Huawei channel needs to add the Huawei push configuration file, that is, the agconnect-services.json file, to the project's 'assets' directory. The path to obtain the file is as follows: Log into [Huawei Open Platform] (https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/android-integrating-sdk-0000001050040084), then enter [My Project]> Select Project> [Project Settings], and download the latest configuration file agconnect-services.json for the Huawei app.
  • Starting from MSDK3.3.18 version, the configuration in the AndroidManifest.xml of Huawei vendor channel push has changed. For details, please refer to vendor channel component configuration.

2.1 Add permissions and component and app information configuration to AndroidManifest.xml

For details, please refer to Tencent Cloud Version Client Configuration (Search: Required permissions for TPNS, Component configuration for TPNS)

If the access point is the Shanghai cluster, the following configuration needs to be processed

Add the following nodes in AndroidManifest.xml

                  

  • XG_GUID_SERVER, XG_STAT_SERVER and XG_LOG_SERVER need to carry https header, and XG_SERVER_SUFFIX does not carry https header

2.2 Add accessId and accessKey configuration

TPNS needs to configure accessId and accessKey. There are two ways to complete the configuration. One way is to configure them in AndroidManifest.xml and the other is to configure them in msdkconfig.ini. The following is a reference example of msdkconfig.ini:

XG_V2_ACCESS_ID=xxx
XG_V2_ACCESS_KEY=xxx

Note: XG_V2_ACCESS_ID is a string of integer numbers. If this configuration item is set in both AndroidManifest.xml and msdkconfig.ini, the latter shall prevail.

2.3 Log off XG free version

If you do not log off the free version, the same user may receive two identical messages during the upgrade and coverage process of App. The way to log off it is to configure the accessId of the XG free version in AndroidManifest.xml. The configuration example is as follows:

<application>
...
    <meta-data
            android:name="XG_OLD_ACCESS_ID"
            android:value="xxx" />
...
</application>

Among them, old_access_id is filled in with the accessId of the free version XG before the upgrade. If you don't know it, you can query it in Feiying system's SDK parameters section.

2.4 Vendor channel

After TPNS is upgraded, it supports Huawei, Xiaomi, Meizu and OPPO vendor channels. The game needs to apply for the app id, app key, and app secret of each channel by itself (OPPO is involved) and fill in the corresponding results in the TPNS console and client. For specific access guidelines, please refer to Vendor Channel PushMSDK 3.3.255 has begun to remove Huawei, Xiaomi and vivo vendor channel-related capabilities; MSDK 3.3.256 has begun to remove Meizu vendor channel-related capabilities;MSDK version 3.3.28 updates TPNS to version 1.3.7.2 to restore the vendor channel push capability.

2.5 Delete TPNS

If you do not access TPNS, you need to modify and delete the following content, as follows:

  • PUSH is set to false in msdkconfig.ini
  • Delete the TPNS configuration in AndroidManifest.xml and msdkconfig.ini, that is, delete the configuration description in 2.1, 2.2, and 2.3
  • Delete all MSDKLibrary/libs/tpns-*.jar files (starting from version 3.3.18, it is needed to delete TPNSSDK and HWPushSDK plugins at the same level as MSDKLibrary)
  • Please delete vendor channels according to the vendor channel guidelines

3 Console configuration instructions

3.1 Create products and apps

Create products and apps. For details, refer to Tencent Mobile Push - Create Product and Application Documentation

3.2 Apply for trial

Click [Apply for Trial/Test] on the page, fill in "Tencent" for the company name, and enter the phone number and email address according to the information filled in by the applicant. After application, you can contact MSDK Assistant for specific usage methods

3.3 Create a push task and a push test method

Create a push task and a push test method. For details, please refer to Tencent Mobile Push-Create Push Task and Push Test Method Documentation

4 TPNS's service payment instructions

TPNS's service payment instructions. For details, please refer to Payment Instructions Documentation

Tencent Cloud version's contact person: Tencent Cloud Assistant (cloud IT support)

MSDK V3.3.15 and later versions add the following interface

1 Account binding

1) Function description

Developers can bind user-defined accounts for different users, and then push the accounts. The accounts cannot be empty. A single app can have up to 10,000 user-defined tags/accounts, and each device token can be bound to up to 100 user-defined tags/accounts.

  • The account here can be any type of business accounts such as a mailbox, QQ number, mobile phone number, user name, etc.
  • When multiple devices are bound to the same account, the backend will push the message to the last bound device by default
2) Interface declaration

The declaration and related parameter descriptions can be viewed in the WGPlatform.h file

void WGSetPushAccount(unsigned char *account);
3) Parameter description
Parameter name Type Description
account unsigned char * Account
4) Demo code
WGPlatform::GetInstance()->WGSetPushAccount("account");

2 Unbind account

1) Function description

Unbind the bound user-defined account, which cannot be empty.

  • Account unbinding is just to disassociate Token from the App account. If you use the full amount/tag/Token push, you can still receive notifications/messages
2) Interface declaration

The declaration and related parameter descriptions can be viewed in the WGPlatform.h file

void WGDeletePushAccount(unsigned char *account);
3) Parameter description
Parameter name Type Description
account unsigned char * Account
4) Demo code
WGPlatform::GetInstance()->WGDeletePushAccount("account");

3 De-registration

1) Function description

When the user has logged out or App is closed and no longer needs to receive push notifications, you can cancel the registration of the App, that is, de-registration. (Once the device is de-registered, the device will not be able to receive the sent message until the device re-registers successfully).

  • Do not make de-registration too frequently, because this may cause the backend synchronization delay
  • There is no need to de-register in case of account switch. The last registration will automatically prevail in case of multiple registrations
2) Interface declaration

The declaration and related parameter descriptions can be viewed in the WGPlatform.h file

void WGUnregisterPush();
3) Parameter description

None

4) Demo code
WGPlatform::GetInstance()->WGUnregisterPush();

Send push message

EnterThe Flying Eagle System. On the left navigation bar, click MSDK management -> message management (those having no permissions can use RTX to contact marsrabelma (Ma Teng) to open permissions). And in the open UI, click Message (Formal Environment) button, and click + Push Notice button in the formal environment to add the push message, as shown in the following diagram:

Note:

When testing push messages, do not push their full amount. You can use a single account or batch accounts to test them to avoid the whole network users from receiving the test push message.

Add local push

In addition to remote push, the game can also push local messages, such as physical recovery reminder.

Android local push

Clear local push

1 Android local push

1)Function description

Local push is message notification which can be completed in the local. Unlike remote push, it doesn't need to interact with the remote server. It is mainly used in physical recovery reminders and other scenes.

2)Interface declaration
public static long WGAddLocalNotification(LocalMessage msg);
3)Parameter description
Parameter name Type Description
msg LocalMessage class skip to view it
4)Return value

1 Add successfully, 0 Add unsuccessfully

5)Demo code
string[] times = "20150907 07 01".split (" ");
LocalMessage msg = new LocalMessage();
msg.type = 1;
msg.action_type = 1;
msg.content = "Pigeon local push test";
msg.title = "You have new messages";
msg.date = times[0];
msg.hour = times[1];
msg.min = times[2];
WGPlatform.WGAddLocalNotification(msg);
6)Special description

msg.hour and msg.min must be two-digit numbers, such as 01,02. In versions earlier than Pigeon 3.0, if targetdkversion is >= 23 when the game is compiled, push may not be received in Android6.0 system.

7)Name interpretation

None

2 Clear local push

1)Function description

The game can clear all local push notifications that have been added but have not yet been executed.

2)Interface declaration
public static void WGClearLocalNotifications();
3)Parameter description

None

4)Return value

None   

5)Demo code
WGPlatform.WGClearLocalNotifications();
6)Special description

None

7)Name interpretation

None

Tag push

The game can set tags for the user, such as gender, age, education, hobby, etc.; in addition, some default tags are preset in SDK. When pushing messages, you can push targeted messages based on different tags.

1 preset tag

2 set tag

3 delete tag

4 send the tagged push message

1 preset tag

Pigeon now offers the following three types of preset tags, and the game doesn't need to set additional tags:

Geographic location (provincial level)
App version
Lost user (3 days or 7 days)

2 set tag

1)Function description

The game can set tags for different users. A game can set a total of up to 10,000 tags. Each user can set up to 100 tags in a game. When setting a tag, note that the tag can not contain any space.

2)Interface declaration
public static void WGSetPushTag(string tag);
3)Parameter description
Parameter name Type Description
tag string it is not allowed to be null or contain any space
4)Return value

None

5)Demo code:
public static WGPlatform.WGSetPushTag("Student");
6)Special description

None

7)Name interpretation

None

3 delete tag

1)Function description

Delete the set user tag. When you push a message, the user will not be able to receive the push message under the tag.

2)Interface declaration
public static void WGDeletePushTag(string tag);
3)Parameter description
Parameter name Type Description
tag string it is not allowed to be null or contain any space
4)Return value

None

5)Demo code
WGPlatform.WGDeletePushTag("Student");
6)Special description

None

7)Name interpretation

None

4 Send the tagged push message

Sending the tagged push message is the same with Send push message. It only needs to choose personalized push for the covered crowd range when adding the push message, as shown in the following diagram:

Vendor Channel Push

1 Function description

Android vendor channel, a system-level push channel provided by Android smartphone vendors, can receive and display messages without launching App. This function can solve the problem that some vendors' smartphones cannot receive notifications when the process is killed, and improve the arrival rate of messages. Currently, vendor channels accessed and supported by MSDK Tencent Mobile Push include: Huawei, Xiaomi, Meizu and OPPO. Version 3.3.11 begins to add this capability.MSDK 3.3.255 has begun to remove Huawei, Xiaomi and vivo vendor channel-related capabilities; MSDK 3.3.256 has begun to remove Meizu vendor channel-related capabilities;MSDK version 3.3.28 updates TPNS to version 1.3.7.2 to restore the vendor channel push capability.

2 Access configuration

TPNS vendor channel involves different vendors and there are a small amount of differences among the vendors, so its access process is relatively troublesome. After it is packaged by MSDK, developers only need to download SDK and add the corresponding configuration to access it. There are two main configuration items: client configuration and console configuration.

2.1 Client configuration

1) Add permissions and vendor channel component configuration to AndroidManifest.xml

For details, please refer to Vendor Channel Client Configuration (Search: Permission configuration for access to TPNS vendor channel, TPNS vendor channel component's configuration)

2) Configure vendor channel information and enable vendor channel functions

Open the msdkconfig.ini file in the 'assets' directory of the game project, and add relevant configuration information. For sources of the required appId and appKey, please refer to the TPNS official website description:

Huawei, Xiaomi, Meizu, OPPO

The reference example is as follows:

; Whether to enable the vendor channel, true: yes, false, no; the vendor channel is not enabled by default
XG_OTHER_PUSH_ENABLE=true
; Xiaomi channel's appid
XG_OTHER_PUSH_XIAOMI_APPID={ Xiaomi appId}
; Xiaomi channel's AppKey
XG_OTHER_PUSH_XIAOMI_APPKEY={ Xiaomi appKey}
; Meizu channel's appId
XG_OTHER_PUSH_MEIZU_APPID={ Meizu appId}
; Meizu channel's appKey
XG_OTHER_PUSH_MEIZU_APPKEY={ Meizu appKey}
; OPPO channel's appId (Note: fill in the appKey of OPPO channel)
XG_OTHER_PUSH_OPPO_APPID={OPPO appKey}
; OPPO channel's AppSecret
XG_OTHER_PUSH_OPPO_APPSECRET={OPPO appSecret}

Remarks:

  1. The appKey of Huawei channel needs to be configured in AndroidManifest.xml
  2. Fill in the appKey of the channel in the appId of the OPPO channel
3) Add Meizu notification icon

For low versions of Meizu smartphones (Meizu Flyme6.0 and below), you need to add an image named stat_sys_third_app_notify.png in the 'res/drawable' directory. The size of the image is generally 64*64. If there are multiple resolutions, it is recommended to add one image in each resolution.

If there is no such image, Meizu phones with low version may not display the message after receiving the message. Of course, if you don't consider Meizu low version phones, this step can be ignored.

4) Code obfuscation
-ignorewarning
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.hianalytics.android.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-keep class com.huawei.android.hms.agent.**{*;}
-keep class com.xiaomi.**{*;}
-keep public class * extends com.xiaomi.mipush.sdk.PushMessageReceiver
-dontwarn com.meizu.cloud.pushsdk.**
-keep class com.meizu.cloud.pushsdk.**{*;}

2.2 Console configuration

You can configure the vendor channel by using Feiying system console or TPNS console directly, both of which need to be enabled in the vendor configuration and set the vendor channel.
Take Feiying system as an example. First, open the message management in your app and open the app configuration. The corresponding setting is as follows:

After the setting is completed, it will take effect within a few minutes to an hour.

3 Verification method

The verification process of each channel is the same. After the process is killed, that notifications are still received means that the function still works normally. Specific steps are as follows:

(1) Confirm that the relevant app information has been filled in "App Configuration - Vendor & Overseas Channels" in the Feiying system's TPNS management console. Generally, the relevant configuration will take effect in 1 hour. Please wait patiently and proceed to the next step after it takes effect.

(2) Install the integrated App (test version) on the test machine and run the App

(3) Keep the App running on the front-end, and try to push messages to a single device/all devices

(4) If the devices receive messages, what is to do next is to put the App to the backend and kill all App processes

(5) Perform single push/all push again. If the device can receive the push message, this indicates that the vendor channel integration is successful

4 Delete a vendor channel

Because a vendor channel needs to introduce a lot dependencies, games that do not require a vendor channel can delete the corresponding dependencies.

If you have configured AndroidManifest.xml and msdkconfig.ini, please refer to "2.1 Client configuration" instructions to restore them.

FAQ

Check steps for the problem that messages pushed by the game can't be received normally

  1. Check if the value of PUSH in the game package's assets/msdkconfig.ini file is true. If not, change it to true and debug again. If yes, continue to check.

  2. Confirm that the name of the game package is the same as the name of the package filled in the registration: Check whether the package name registered at http://dev.ied.com/ is the same as the one you are using. Make sure both are the same (note: see whether the package name contains any spaces in the header or trailer). If yes, continue to check.

  3. Check if the configuration in AndroidManifest.xml and msdkconfig.ini on TPNS is complete. If yes, continue to check.

  4. Check if so files under MSDKLibrary/lib are all copied to the game's corresponding directory. If yes, continue to check.

  5. Check if TPNS is registered successfully:

    Make configurations according to the above steps and then start the game's filter log. If the following log exists, this shows the device has been registered successfully. Now, you can push messages in the Flying Eagle system to Android platforms

    msdkpush_1

    If you see the following log after logging in the system successfully, this indicates that users are bound successfully. Now, you can push the number package in the Flying Eagle system

    msdkpush_1

  6. Check if xg_vip_service process exists. If not, messages can't be received (see ps | grep xg_vip_service in adb shell). If TPNS process exists, contact MSDK developer to solve the problem.

If you want to upgrade the free version of XG to TPNS version, you need to delete the following content

Upgrading the free version of XG to TPNS version needs to clean up the old version's files and configurations, including permissions, component configurations as well as the XG jar and so files in the MSDKLibrary directory. It is recommended to replace them as a whole to avoid any omissions caused by manual modifications. The deleted content is as follows:

  1. Delete AndroidManifest.xml related configurations

Mainly remove two parts from AndroidManifest.xml: the free version's permission configuration and component configuration.

  • On the basis of the original version, you can search for keywords, such as "Other permissions required for access to XG START, Other permissions required for access to XG END "and " XG configuration START, XG configuration END", to quickly find the relevant configuration of the free version, and then delete the content between START to END​​in the corresponding section.
  • If you have previously accessed a vendor channel and the Tencent Cloud version no longer needs the vendor channel, please delete the corresponding configuration of the vendor channel accordingly. You can search for keywords, such as " XG vendor channel component configuration START, XG vendor channel component configuration END", to quickly find the related configuration of the vendor channel, and then delete the content between START to END​​in the corresponding section. If the vendor channel is needed, you can keep the related configuration of the vendor channel.

  • Delete msdkconfig.ini related configuration

If you have accessed a vendor channel before and the Tencent Cloud version no longer needs the vendor channel, please delete the corresponding configuration of the vendor channel accordingly. If you need the vendor channel, you can keep the vendor channel related configuration.

; XG vendor channels are disabled by default in the release version of XG. If you want to enable a vendor channel, please set the appId and appKey of the vendor channel. Huawei channel is configured in Manifest
XG_OTHER_PUSH_ENABLE=false
XG_OTHER_PUSH_XIAOMI_APPID=xxx
XG_OTHER_PUSH_XIAOMI_APPKEY=xxx
XG_OTHER_PUSH_MEIZU_APPID=xxx
XG_OTHER_PUSH_MEIZU_APPKEY=xxx
  1. List of files to be deleted

Before upgrade, please make sure to delete the following files, or make sure that the MSDKLibrary directory has been replaced as a whole.

+ libs/Xg_sdk_4.x.x_2019xxxx_xxxx.jar + libs/wup-1.0.0.E-SNAPSHOT.jar + libs/abieabi_xxx/libtpnsSecurity.so + Libs/abieabi_xxx/libxguardian.so (3.3.7a and above versions have no the libxguardian.so)

If you have accessed vendor channels before, please delete them one by one (Tencent Cloud version's vendor channels need to import new ones):

+ MSDKLibrary/libs/XG4HWPush.jar + MSDKLibrary/libs/XG4MZPush.jar + MSDKLibrary/libs/XG4XMPush.jar

TPNS joint survival capability related configuration

MSDK V3.3.131 version starts to add this capability. TPNS Android supports the configuration of the joint survival capability, which is disabled by default, to prevent its own app from launching other apps, without additional configuration. If the following log is printed, this indicates that the joint survival capability has been disabled:

I/TPNS: [ServiceUtil] disable pull up other app

If you want to enable the joint survival capability, you can add the following configuration to the assets/msdkconfig.ini file:

XG_PULL_UP_OTHER_APP_ENABLE = true

In addition, you can modify the following nodes in the AndroidManifest.xml file to configure that your app will not be launched by other apps

<!-- Modify the following nodes in the AndroidManifest.xml file of your app, where xxx is any user-defined name: -->
<!-- If you want to close the joint survival function with TPNS application, please configure  -->
   <provider
       android:name="com.tencent.android.tpush.XGPushProvider"
       tools:replace="android:authorities"
       android:authorities="the app's package name.xxx.XGVIP_PUSH_AUTH"
       android:exported="false" />
``` 

### Frequent equipment information collection solution of Xiaomi vendor channel

For the Xiaomi vendor SDK problem, the solution is as follows. You can refer to Solution 1 or Solution 2 to handle it:

#### 1. Do not access Xiaomi vendor channel

##### 1.1 Delete Xiaomi vendor channel's jar file
Delete tpns-xiaomi-x.x.x.x.jar (versions earlier than MSDK 3.3.18 version: xm4tpnsx.x.x.x.jar)

##### 1.2 Delete the configuration of Xiaomi vendor channel in AndroidManifest.xml

**Permission**

         

**Component configuration**

                                                                                   

                                                                                                                                                                                                                                     

##### 1.3 Delete Xiaomi vendor channel's configuration information in the msdkconfig.ini file under the project's 'assets' directory

; Xiaomi channel's appid XG_OTHER_PUSH_XIAOMI_APPID={ Xiaomi appId} ; Xiaomi channel's AppKey XG_OTHER_PUSH_XIAOMI_APPKEY={ Xiaomi appKey}

##### 1.4 Delete Xiaomi vendor channel's code obfuscation

-keep class com.xiaomi.*{;} -keep public class * extends com.xiaomi.mipush.sdk.PushMessageReceiver ``` 

2. It is needed to access Xiaomi vendor channel and solve the problem about the frequent equipment information collection

You need to contact the TPNS side to guide access to the overseas version of the Xiaomi manufacturer channel, and contact the MSDK assistant for docking.