The Tencent Push Notification Service SDK uses an implicit PendingIntent in TPushAlarmManager.set
in the code to trigger SDK internal heartbeats.
You can address the issue by referring to Google's Remediation for Implicit PendingIntent Vulnerability. The following self-check has been performed for the SDK:
a. The setAction
used is a static broadcast action declared by the SDK and poses no exposure risk.
b. The target of the PendingIntent is the SDK's internal static broadcast action, and the broadcast permission declared by SDK has been added.
Google's documentation mentions the following: "Fixing this issue is recommended but not mandatory. The publication status of your app will be unaffected by the presence of this issue."
The current PendingIntent used by Tencent Push Notification Service is a trusted and secure PendingIntent, and Google claimed that the issue will not affect the publication of your application. You can ignore this message and continue to publish your application.
You can set a custom ringtone by creating a notification channel.
n_ch_id
for push. For a vendor channel, you must specify the vendor channel ID, such as hw_ch_id
for the Huawei channel and xm_ch_id
for the Mi channel.Note:
To disable the feature, call the following API in onCreate
of Application
or LauncherActivity
during application initialization and pass in false
:
Note:The session keep-alive feature can be disabled only in SDK v1.1.6.0 or later. In SDKs earlier than v1.1.6.0, the feature is enabled by default and cannot be disabled.
XGPushConfig.enablePullUpOtherApp(Context context, boolean pullUp);
If you use Gradle automatic integration, configure the following node under the <application>
tag of the AndroidManifest.xml
file of your application, where xxx
is a custom name. For manual integration, modify node attributes as follows:
<!-- Add the following node to the `AndroidManifest.xml` file of your application, where xxx is a custom name: -->
<!-- To disable the feature of keep-alive with Tencent Push Notification Service, configure as follows: -->
<provider
android:name="com.tencent.android.tpush.XGPushProvider"
tools:replace="android:authorities"
android:authorities="application package name.xxx.XGVIP_PUSH_AUTH"
android:exported="false" />
If the following log is printed in the console, the session keep-alive feature has been disabled: I/TPush: [ServiceUtil] disable pull up other app
For the scenario where the user agrees to the Terms of Service and Privacy Policy, you can add the following node to the AndroidManifest.xml
file, so that the push service is not automatically enabled at the first start of the application after installation until the push service registration API XGPushManager.registerPush()
is called:
<meta-data
android:name="XG_SERVICE_PULL_UP_OFF"
android:value="true" />
HarmonyOS is fully compatible with the Android SDK, so HarmonyOS users can use the push feature normally.
Vendor | Need to Be Launched to Application Markets |
---|---|
Mi | Yes. You need an enterprise developer account to enable Mi Push. For details, see here. |
Meizu | No. You only need an individual developer account to enable Meizu Push. For details, see here. |
FCM | No. You only need an individual developer account to enable FCM Push. |
Huawei | No. You only need an individual developer account to enable Huawei Push. For details, see here. |
OPPO | Yes. You need an enterprise developer account to enable OPPO PUSH. For details, see here. |
vivo | Yes. You need an enterprise developer account to enable vivo Push. For details, see here. |
After you integrate the push services of the vivo channel, certain security detection tools may prompt that "the application contains unused permission strings". Details are as follows:
Cause: vivo channel push SDK v2.3.4
Class file involved: com.vivo.push.util.z
; sensitive permission string involved: android.permission.GET_ACCOUNTS
Note:Inspection found that the problem still persists in the vivo channel push SDK v3.0.0.3.
The defective code is from the vivo channel push SDK. The Tencent Push Notification Service team is unable to change the code and has reported it to vivo. vivo replied that the relevant static fields are the legacy code of the SDK and are not actually used, and they will schedule to fix the problem as soon as possible. The following are quick solutions for your reference:
XGPushManager.unregisterPush\(this\)
API has been called.Access ID
and Access Key
are correctly configured. Common errors include misuse of Secret key
instead of Access Key
or spaces before and/or after Access Key
.Perform automated troubleshooting with the troubleshooting tool as instructed here. General errors include the following:
Tencent Push Notification Service is not available on Nubia phones released after 2015, because the new version of Nubia operating system added a super power-saving feature that kills background processes quickly and prevent the Service from being started, resulting in failures of registration with Nubia phones.
From SDK v1.1.6.3, in order to avoid the situation where push services of other vendors auto-start and transfer user data on the background on a phone, push service components of other vendors will be disabled on the phone.
Huawei uses some common components for different features such as account, game, and push. Disabling the push component by Tencent Push Notification Service may make other service features unable to start on a non-Huawei phone. To disable this disablement feature, configure the following:
Add the following node configuration under the application
tag of the AndroidManifest.xml
file, uninstall the application, and reinstall it.
<meta-data
android:name="tpns-disable-component-huawei-v2"
android:value="false" />
<meta-data
android:name="tpns-disable-component-huawei-v4"
android:value="false" />
You can redirect subscribers who click your notification to a specified in-app page, HTML5 page, or Deeplink to meet your needs in different use cases. For more information, please see Notification Tap-to-Redirect.
Callback | Arrival Callback | Click Callback |
---|---|---|
Mi | Not supported | Supported |
Meizu | Not supported | Supported |
FCM | Not supported | Supported |
Huawei | Not supported | Supported |
OPPO | Not supported | Supported |
vivo | Not supported | Supported |
Note:Click callback of vendor channels is supported by SDK v1.2.0.1 and later. Legacy versions support this feature only for Huawei, Mi, Meizu, and vivo.
title
and content
obtained by onNotifactionClickedResult
and onNotificationShowedResult
are empty when the application is closed?To obtain the title
and content
of the offline push via a vendor channel, concatenate title
and content
parameters to the intent uri
of notification tap-to-redirect, and obtain them after notification tap-to-redirect. See Notification Tap-to-Redirect for details.
other push Token
that occurs during debugging after my application is integrated with a vendor channel?Check whether the application operation logs contain information similar to the following:
[OtherPushClient] handleUpdateToken other push token is : other push type: huawei
Such log information means that your application failed to register with the vendor channel. In that case, get the return code for vendor channel registration failure to locate and troubleshoot the problem. For more information, see Troubleshooting Vendor Channel Registration Failures.
target sdk
is greater than or equal to 21, making the icon gray.target sdk
to a value smaller than 21. If you don't want target sdk
to be below 21, you can rename a small .png image with a transparent background to notification_icon.png
(the filename must be unique) and place it in the drawable
directory; in this way, the small icon will be displayed as gray (but shaped).notification_icon.png
small icon resource will only take effect directly on Google Pixel phones by default. To achieve such small icon effect for custom notifications on other phones, you need to specify the resource filename (without the extension) as the value of the message.android.small_icon
field in the push API. In addition, the custom notification small icon supports solid colors by specifying the decimal value of an RGB color as the value of the message.android.icon_color
field in the push API.Below is an example of push API fields, where icon_color: 123456
indicates the RGB color #01e240:
{
"message": {
"android": {
"small_icon": "notification_icon",
"icon_color": 123456
}
}
}
The display effect after adaption is as shown below. We recommend you draw an icon based on the demo logo.
Note:
In the above two cases, you need to place an image exactly named stat_sys_third_app_notify
in the drawable
folders named at different resolutions. You can get the image from the flyme-notification-res
folder under meizu
of Tencent Push Notification Service Android SDK.
debug
field in the tpns-configs.json
file to true
and run the following command: ./gradlew --rerun-tasks :app:processReleaseManifest
Then, analyze with the TpnsPlugin
keyword.
2. Click the sync projects icon.
3. Check whether relevant dependencies exist in External Libraries of the project.
Add the following attributes to the gradle.properties
file of the AndroidX project:
android.useAndroidX=trueandroid.enableJetifier=true
Note:
android.useAndroidX=true
: to enable AndroidX for the current project.android.enableJetifier=true
: to migrate the dependency package to AndroidX.
After you integrate the push services of various vendor channels, certain security detection tools may prompt that "the application transferred information over HTTP in plaintext". HTTP addresses involved are as follows:
All the above HTTP URLs are from the push SDKs of relevant vendors. The Tencent Push Notification Service team is unable to clarify their purposes or control their behaviors, but is actively contacting them and promoting the adoption of transfer over HTTPS. Currently, you should evaluate and choose whether to continue to use the above vendors' push services.
If the number of loaded methods in the project exceeds 65,000, please create subpackages for the project.
Activity
page, but the redirection fails frequently?On some phones, redirection upon click on the notification bar may experience permission issues.
Solution: In androidManifest.xml
, add android:exported="true"
to the Activity
page to be opened.
The registration method can be called anywhere, but applicationContext
must be input.
No. Google services and a network with normal access to Google are necessary for using the FCM channel.
The FCM channel is applicable to clusters in Hong Kong (China) and Singapore.
Troubleshooting process:
Vendor channel delivery failure:
Tencent Push Notification Service channel delivery failure:
Possible case 1: The Tencent Push Notification Service backend delivered the message via the Tencent Push Notification Service channel when the link between the Tencent Push Notification Service SDK and the backend was actually disconnected. As a result, the message failed to reach the device.
Possible case 2: By default, the Tencent Push Notification Service SDK sends a heartbeat at an interval of five minutes to maintain a persistent connection. When it fails to send a heartbeat, the SDK immediately rebuilds the persistent connection. For example, if the SDK receives five push messages from the backend before the persistent connection is rebuilt successfully, only the latest three push messages will be delivered after the persistent connection is rebuilt. As a result, the first two push messages are delivered through the Tencent Push Notification Service channel and fail to reach the device.
Possible case 3: No arrival event was reported but the message actually reached the device (the actual push effect is not affected).
Was this page helpful?