05/15/2024 15:19:45

Problem description

TPNS has the behavior of starting other APPs (chain wake-up).

Image Description

Cause of the problem

There may be two types:
Scenario 1: There are the behavior of launching other apps every time the game is started.
Reason: Games actively turn on the session keep-alive feature switch of TPNS. The corresponding switches are as follows:

The V3 version has the following configuration in the assets/msdkconfig.ini file:
XG_PULL_UP_OTHER_APP_ENABLE = true

The V5 version has the following configuration in the MSDKConfig.ini file:
XG_PULL_UP_OTHER_APP_ENABLE = true

Scene 2: If the session keep-alive feature switch of TPNS is set to false, TPNS will have the behavior of starting other APPs only when the installed game is started for the first time, and TPNS will not have the behavior of starting other APPs when the installed game is restarted.
Reason: This is caused by the asynchronous and delayed effectiveness of the call for TPNS interface. When a game is installed and started for the first time, the flag bit set by the call takes effect later than the timing of reading the flag bit during the activation of the push service.

Solution

1 Disable the session keep-alive feature of TPNS

If the session keep-alive feature of TPNS is enabled, it is needed to set XG_PULL_UP_OTHER_APP_ENABLE to false (if XG_PULL_UP_OTHER_APP_ENABLE itself is set to false, directly deal with it according to Point 2);

2 Delay starting TPNS service

You can refer to Plan a or Plan b for this.

a. Make configuration in AndroidManifest.xml

Add meta-data under the 'application' level

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

b. Use the code to achieve this purpose

You can directly call the TPNS-side interface to process this. TPNS platform's documentation guidelines: https://cloud.tencent.com/document/product/548/36674#.E5.A6.82.E4.BD.95.E5.85.B3.E9.97.AD-tpns-.E7.9A.84.E4.BF.9D.E6.B4.BB.E5.8A.9F.E8.83.BD.EF.BC.9F

Image Description

Remarks

Support from versions:

  1. The above solution begins to be supported in the TPNS version of MSDK V3.3.132a/V5.10;
  2. In case of MIUI 12 system, the above solution begins to be supported in the TPNS version of MSDK V3.3.16a/V5.13;
  3. Starting from V 3.3.18/V5.16 version, Plan a of Point 2 of the solution has been used as the default configuration.

3 If you want to access the Xiaomi channel, you need to remove the intent-filter settings in NetworkStatusReceiver

Image Description

Others:

  1. The delayed service startup means that, when APP is installed and started for the first time, the background push service is not started automatically until the user actively calls the registration interface;
  2. If the following log is printed, this indicates that the joint survival capability has been turned off: I/TPNS: [ServiceUtil] disable pull up other app.
    3. Instructions about the self-start of TPNS
    Before version 5.21, TPNS has a self-start problem. Currently, the corresponding configuration has been removed. However, the impact brought by this is that the Android side of TPNS cannot be self-started. If you need the self-start function, please restore the configuration. The restoration method is as follows.
<receiver
    android:name="com.tencent.android.tpush.XGPushReceiver"
    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>

are changed to:

<receiver
    android:name="com.tencent.android.tpush.XGPushReceiver"
    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" />
        <!-- [Optional] System broadcast: network switch -->
        <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
        <!-- [Optional] System broadcast: open screen -->
        <action android:name="android.intent.action.USER_PRESENT" />
        <!-- [Optional] Some commonly used system broadcasts can enhance the resurrection chance of TPNS. Please choose them according to your needs. Of course, you can also add some broadcast-initiated services defined by App -->
        <action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
        <action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
        <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
    </intent-filter>
</receiver>

Warning: With consideration about internal policy issues, it is not recommended to add optional permissions.



Copyright © 2024 MSDK.
All rights reserved.

results matching ""

    No results matching ""