Use the token obtained to push at TPNS' official website. Please troubleshoot according to conditions described below if pushes cannot be received. Make sure you have the latest SDK version, because issues in the old version may have been fixed in the latest version. Try refreshing the webpage if error occurs in website push.
[Parameters are incorrectly entered]
[Registration returned an error]
[Registration had no callback]
Account, also known as alias, refers to the user account of an app with account login function. This is not only for QQ or WeChat, and all accounts of the user are supported. For example, the account of Mobile QQ is QQ account number, the account of Gmail is the email address, and the account of China Mobile is the mobile number.
For users to whom pushes are to be made based on the account, you need to bind the account to the token first; otherwise, pushes will fail. On Android, account binding is performed upon registration, namely through the registerPush(context,account) API. On iOS, it is configured through setAccount.
(1) The account or alias is unregistered. It is not necessarily due to app call, in some cases, the unregistration may be triggered automatically.
(2) The device is registered with another account or alias, which will automatically unbind the original one. (One device can only correspond to one alias. If there is no device under the current alias, there will certainly be a "not found" error.)
Please check whether the tag is successfully bound. An app can have up to 10,000 tags, each token can have up to 100 tags in one app, and no spaces are allowed in the tag.
/**
* Query the token tag
*/
public function QueryTokenTags($deviceToken)
{
$ret = array('ret_code' => -1);
if (!is_string($deviceToken)) {
$ret['err_msg'] = 'deviceToken is not valid';
return $ret;
}
$params = array();
$params['access_id'] = $this->accessId;
$params['device_token'] = $deviceToken;
$params['timestamp'] = time();
return $this->callRestful(self::RESTAPI_QUERYTOKENTAGS, $params);
}
[Push is paused]
Full push limitations (V2, V3):
Tag push limitations (V3):
[Effect statistics]
[Actually delivered pushes]
[Historical details]
[Data overview]
Since tapping a message generates a tap event by default in the current SDK, the default tap event is to open the main interface. Therefore, if a redirection action is set in the onNotifactionClickedResult method of the device message tap callback, the custom redirection will conflict with the default tap event. The result is that after tapping, the user will be redirected to the specified interface and then returned to the main interface. As a result, you cannot set redirection in onNotifactionClickedResult.
Below lists the solutions (the first one is recommended):
[1] Use Intent to redirect to the specified page (this method is for Android 3.2.3 and higher)
<activity
android:name="com.qq.xg.AboutActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="xgscheme"
android:host="com.xg.push"
android:path="/notify_detail" />
</intent-filter>
</activity>
If you use the server SDK to set the intent for redirection, you can set the intent to the following (with the Java SDK as an example):
action.setIntent("xgscheme://com.xg.push/notify_detail");
If you want to bring parameters such as param1 and param2, you can set as below:
action.setIntent("xgscheme://com.xg.push/notify_detail?param1=aa¶m2=bb");
Get the parameters on the device:
Uri uri = getIntent().getData();
if (uri != null) {
String url = uri.toString();
String p1= uri.getQueryParameter("param1");
String p2= uri.getQueryParameter("param2");
}
Uri uri = getIntent().getData();
if (uri != null) {
String url = uri.toString();
UrlQuerySanitizer sanitizer = new UrlQuerySanitizer();
sanitizer.setUnregisteredParameterValueSanitizer(UrlQuerySanitizer.getAllButNulLegal());
sanitizer.parseUrl(url);
String value1 = sanitizer.getValue("key1");
String value2 = sanitizer.getValue("key2");
Log.i("XG" , "value1 = " + value1 + " value2 = " + value2);
}
[2] Set the page to redirect to upon message tap when delivering the message
(a) You can set the deeplink (package name + class name) directly in the web-based advanced functions;
(b) Set the SetActivity method (package name + class name) of the Action field in the Message class in the backend, and get the relevant content of the message through XGPushClickedResult: title, content, and additional parameters.
......
XingeApp android = new XingeApp(accessID,secretkey);
Message message_android =new Message();
message_android.setExpireTime(86400);
message_android.setTitle("TPNS");
message_android.setType(1);
message_android.setContent("android test2");
ClickAction action =new ClickAction();
action.setActivity("com.qq.xgdemo.activity.SettingActivity");
message_android.setAction(action);
JSONObject ret1 = android.pushSingleDevice("token",message_android);
......
// this must be the context of the page to redirect to upon tap.
XGPushClickedResult clickedResult = XGPushManager.onActivityStarted(this);
// Get the parameters near the message
String ster = clickedResult.getCustomContent();
// Get the message title
String set = clickedResult.getTitle();
// Get the message content
String s = clickedResult.getContent();
[3] Send in-app message to the device; the user-defined notification bar uses local notification pop-up to set the page to redirect to
Note: If you need to get parameters through tap callback or redirect to a custom page, you can use the Intent to do so. Click here to view the tutorials.
For 4.X otherpush version, check whether the vendor-specific channel initialization code is enabled, and add the following to your app's attachBaseContext function:
StubAppUtils.attachBaseContext(context);
For 4.X otherpush version, after the cloud controller successfully downloads the vendor's dex package for the corresponding device, you need to kill the app process and restart the app to complete the registration. The downloaded log is as follows:
10-25 15:16:31.067 16551-16551/? D/XINGE: [DownloadService] onCreate()
10-25 15:16:31.073 16551-16757/? D/XINGE: [DownloadService] action:onHandleIntent
10-25 15:16:31.083 16551-16757/? V/XINGE: [CloudCtrDownload] Create downloadControl
10-25 15:16:31.089 16551-16757/? I/XINGE: [CloudCtrDownload] action:download - url:https://pingjs.qq.com/xg/Xg-Xm-plug-1.0.2.pack, saveFilePath:/data/user/0/com.qq.xgdemo1122/app_dex/XG/5/, fileName:Xg-Xm-plug-1.0.2.pack
10-25 15:16:31.097 16551-16757/? V/XINGE: [CloudCtrDownload] Download file: Xg-Xm-plug-1.0.2.pack
10-25 15:16:31.641 16551-16757/? D/XINGE: [DownloadService] download file Succeed
10-25 15:16:31.650 16551-16757/? D/XINGE: [CloudCtrDownload] Download succeed.
10-25 15:16:31.653 16551-16551/? D/XINGE: [CloudControlDownloadReceiver] onReceive
10-25 15:16:31.673 16551-16738/? I/test: Download file SuccessXg-Xm-plug-1.0.2.pack to /data/user/0/com.qq.xgdemo1122/app_dex/XG/5/
```
If the dex configuration package cannot be downloaded at all, you can use the non-dynamic loading method to integrate it. In this case, you need to use the TPNS v4.X jar without the vendor-specific channels and then integrate the jars of each vendor-specific channel. For more information about how to integrate, see the relevant document.
[Troubleshooting for Mi channel]
<permission android:name="com.example.mipushtest.permission.MIPUSH_RECEIVE" android:protectionLevel="signature" />
<!-- Here, change com.example.mipushtest to the app package name -->
<uses-permission android:name="com.example.mipushtest.permission.MIPUSH_RECEIVE" />
<!-- Here, change com.example.mipushtest to the app package name -->
// Enable the third-party push
XGPushConfig.enableOtherPush(this,true);
// Set the Appid and Appkey of Mi
XGPushConfig.setMiPushAppId(this,MIPUSH_APPID);
XGPushConfig.setMiPushAppKey(this,MIPUSH_APPKEY);
[Troubleshooting for Huawei channel]
[Troubleshooting for Meizu channel]
```
Was this page helpful?