This document describes how to resolve conflicts that arise when integrating TIMPush with products from competitors.
Root Cause
The fundamental reason for client conflicts is the application's own integration or dependency on a third-party push client, which conflicts with the third-party client in TIMPush.
Solutions
If the above situation exists, you can choose the following methods for compatible usage of TIMPush.
Step 1
Please complete the TIMPush access according to the guide document first: Activate and Use Step 2
Method 1: Use the TIMPush push package to share the token with competitors:
1. Remove the corresponding vendor package that conflicts with the competitor;
2. Obtain the push token through the TIMPush interface getPushToken, and then call the competitor's interface to share and acquire the token. The implementation is as follows:
TUICore.callService(TUIConstants.TIMPush.SERVICE_NAME, TUIConstants.TIMPush.METHOD_GET_PUSH_TOKEN, null, new TUIServiceCallback() {
@Override
public void onServiceCallback(int errorCode, String errorMessage, Bundle bundle) {
if (errorCode == 0 && bundle != null) {
String token = (String) bundle.get("token");
Log.d(TAG, "getPushToken onServiceCallback data =" + token);
// Share token
}
}
});
Method 2: Use the competitor's vendor push package to return the token to TIMPush:
1. Remove the vendor package of TIMPush that creates conflicts;
2. Obtain the push token through the competitor's interface, then use the setPushToken interface to set the token for TIMPush. The implementation is as follows:
Map<String, Object> param = new HashMap<>();
param.put(TUIConstants.TIMPush.METHOD_PUSH_BUSSINESS_ID_KEY, 11111);
param.put(TUIConstants.TIMPush.METHOD_PUSH_TOKEN_KEY, "token");
TUICore.callService(TUIConstants.TIMPush.SERVICE_NAME, TUIConstants.TIMPush.METHOD_SET_PUSH_TOKEN, param, new TUIServiceCallback() {
@Override
public void onServiceCallback(int errorCode, String errorMessage, Bundle bundle) {
if (errorCode == 0 && bundle != null) {
String token = (String) bundle.get("token");
Log.d(TAG, "registerPush onServiceCallback data =" + token);
}
}
});
Was this page helpful?