IM terminal users need to obtain the latest messages at any time. However, due to the limited performance and battery power of mobile devices, when the app is running in the background, IM recommends that you use the system-grade push channels provided by vendors for message notifications to avoid excessive resource consumption caused by maintaining a persistent connection. Compared with third-party push, system-grade push channels provide more stable system-grade persistent connections, enabling users to receive push messages at any time and greatly reducing resource consumption.
Supported vendor channels are as below:
Push Channel | System Requirements | Conditions |
---|---|---|
Mi Push | MIUI | To use Mi Push, add the dependency: implementation 'com.tencent.tpns:xiaomi:1.2.1.2-release'. |
Huawei Push | EMUI | To use Huawei Push, add the dependencies: implementation 'com.tencent.tpns:huawei:1.2.1.2-release' and implementation 'com.huawei.hms:push:5.0.2.300'. |
Google FCM Push | Android 4.1 and later versions | To use mobile phones installed with Google Play Services outside the Chinese mainland, add the dependency: implementation 'com.google.firebase:firebase-messaging:20.2.3'. |
Meizu Push | Flyme | To use Meizu Push, add the dependency: implementation 'com.tencent.tpns:meizu:1.2.1.2-release'. |
OPPO Push | ColorOS | Not all OPPO models and versions support OPPO Push. To use OPPO Push, add the dependency: implementation 'com.tencent.tpns:oppo:1.2.1.2-release'. |
vivo Push | Funtouch OS | Not all vivo models and versions support vivo Push. To use vivo Push, add the dependency: implementation 'com.tencent.tpns:vivo:1.2.1.2-release'. |
Here, “offline” means that the app is closed by the system or user without logging out. In such cases, if you want to receive IM SDK message reminders, you can integrate IM offline push.
Note:
- Users who have logged out or have been forced offline will not receive any message notifications.
- For Mi and Huawei vendors, if a ChannelID has been configured on the official website of the vendor developer, you need to configure the same ChannelID on the IM console. Otherwise, push may fail. If you do not configure the ChannelID, you will be limited by the frequency limit.
The process of implementing offline message push is as follows:
When the client app is killed by the system or user without IM logout, the IM server will push the messages sent by other accounts through vendor’s channel.
Primary package name
, AppID
, and AppSecret
information.ID
of the certificate. Certificate information takes effect within 10 minutes after you save it.MiPushClient.registerPush
to initialize the Mi Push service. After successful registration, you will receive the registration result in onReceiveRegisterResult
of the custom BroadcastReceiver
. regId
is the unique identifier of the current app on the current device. After successful login to the IM SDK, you need to call setOfflinePushConfig to report the certificate ID and regId to the IM server.After the certificate ID and regId are successfully reported, the IM server sends messages via Mi Push notifications to the user when the app has been killed but the user has not logged out of IM.
You can select one of the following events: Open app, Open webpage, or Open specified in-app page.
If you choose Open app, the onNotificationMessageClicked
method of Mi will be called back, and the app itself can process app opening in this method.
You need to select Open webpage when adding a certificate and enter a URL that starts with either http://
or https://
, such as https://intl.cloud.tencent.com/document/product/269?from_cn_redirect=1
.
In manifest, configure the intent-filter
of the Activity to be opened. See the sample code below. You can refer to AndroidManifest.xml of the demo:
<activity android:name="com.tencent.qcloud.tim.demo.main.MainActivity" android:launchmode="singleTask" android:screenorientation="portrait" android:windowsoftinputmode="adjustResize|stateHidden">
<intent-filter>
<action android:name="android.intent.action.VIEW">
<data android:host="com.tencent.qcloud" android:path="/detail" android:scheme="pushscheme">
</data></action></intent-filter>
</activity>
Obtain the intent URL, as shown below:
Intent intent = new Intent(this, MainActivity.class);
intent.setData(Uri.parse("pushscheme://com.tencent.qcloud.tim/detail"));
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
String intentUri = intent.toUri(Intent.URI_INTENT_SCHEME);
Log.i(TAG, "intentUri = " + intentUri);
Print results:
intent://com.tencent.qcloud.tim/detail#Intent;scheme=pushscheme;launchFlags=0x4000000;component=com.tencent.qcloud.tim.tuikit/com.tencent.qcloud.tim.demo.main.MainActivity;end
Select Open specified in-app page when adding a certificate and enter the result above.
Select Open app or Open specified in-app page in Response after Click when adding a certificate to support custom content pass through.
Step 1. Set custom content (sender)
Set the custom content for the notification bar message before sending the message.
Below is a simple example on the Android platform. You can also refer to the corresponding logic in the sendMessage()
method in the ChatProvider.java class in the TUIKit:
OfflineMessageContainerBean containerBean = new OfflineMessageContainerBean();
OfflineMessageBean entity = new OfflineMessageBean();
entity.content = message.getExtra().toString();
entity.sender = message.getFromUser();
entity.nickname = chatInfo.getChatName();
entity.faceUrl = TUIChatConfigs.getConfigs().getGeneralConfig().getUserFaceUrl();
containerBean.entity = entity;
V2TIMOfflinePushInfo v2TIMOfflinePushInfo = new V2TIMOfflinePushInfo();
v2TIMOfflinePushInfo.setExt(new Gson().toJson(containerBean).getBytes());
// For OPPO, you must set the `ChannelID` to receive push messages. The `ChannelID` must be consistent with that in the console.
v2TIMOfflinePushInfo.setAndroidOPPOChannelID("tuikit");
V2TIMManager.getMessageManager().sendMessage(v2TIMMessage, userID, null,
V2TIMMessage.V2TIM_PRIORITY_DEFAULT, false, v2TIMOfflinePushInfo, new V2TIMSendCallback<v2timmessage>() {
@Override
public void onError(int code, String desc) {}
@Override
public void onSuccess(V2TIMMessage v2TIMMessage) {}
@Override
public void onProgress(int progress) {}
});
For information on configurations for the IM server, refer to the OfflinePushInfo Format Example.
Step 2. Set custom content (receiver)
If you selected Open app in Response after Click when adding a certificate, clicking the notification bar message triggers the onNotificationMessageClicked(Context context, MiPushMessage miPushMessage)
callback. The custom content can be obtained from miPushMessage
. You can refer to the parsing implementation in XiaomiMsgReceiver.java.
Map extra = miPushMessage.getExtra();
String extContent = extra.get("ext");
If you selected Open specified in-app page in Response after Click when adding a certificate, MiPushMessage
, which is the object that encapsulates the message, is passed to the client through Intent
. The client then obtains the custom content from Activity
. You can refer to the implementation of the parseOfflineMessage(Intent intent)
method in the OfflineMessageDispatcher.java class.
Bundle bundle = getIntent().getExtras();
MiPushMessage miPushMessage = (MiPushMessage)bundle.getSerializable(PushMessageHelper.KEY_MESSAGE);
Map extra = miPushMessage.getExtra();
String extContent = extra.get("ext");
Package name
, APP ID
, Client ID
and Client SECRET
.Activity
class name of the app entry, which will be used as the Huawei desktop app badge for display. For more information, see the description of desktop app badge in the Huawei Push service development document.ID
of the certificate. Certificate information takes effect within 10 minutes after you save it.HmsInstanceId.getToken
API to request the unique app identifier Push Token from the server. Push Token
is the unique identifier of the current app on the current device. After successful login to the IM SDK, you need to call setOfflinePushConfig to report the certificate ID and Push Token to the IM server.After the certificate ID and regId are successfully reported, the IM server sends messages via Huawei Push notifications to the user when the app has been killed but the user has not logged out of IM.
You can select one of the following events: Open app, Open webpage, or Open specified in-app page.
This is the default event, which opens the app once the notification bar message is clicked.
You need to select Open webpage when adding a certificate and enter a URL that starts with either http://
or https://
, such as https://intl.cloud.tencent.com/document/product/269?from_cn_redirect=1
.
intent-filter
of the Activity to be opened. See the sample code below. You can refer to AndroidManifest.xml of the demo:<activity android:name="com.tencent.qcloud.tim.demo.main.MainActivity" android:launchmode="singleTask" android:screenorientation="portrait" android:windowsoftinputmode="adjustResize|stateHidden">
<intent-filter>
<action android:name="android.intent.action.VIEW">
<data android:host="com.tencent.qcloud" android:path="/detail" android:scheme="pushscheme">
</data></action></intent-filter>
</activity>
Obtain the intent URL, as shown below:
Intent intent = new Intent(this, MainActivity.class);
intent.setData(Uri.parse("pushscheme://com.tencent.qcloud.tim/detail"));
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
String intentUri = intent.toUri(Intent.URI_INTENT_SCHEME);
Log.i(TAG, "intentUri = " + intentUri);
intent://com.tencent.qcloud.tim/detail#Intent;scheme=pushscheme;launchFlags=0x4000000;component=com.tencent.qcloud.tim.tuikit/com.tencent.qcloud.tim.demo.main.MainActivity;end
Select Open specified in-app page when adding a certificate and enter the result above.
Note:Due to the compatibility issues of Huawei Push, the pass-through content can only be received on some EUI10+ devices.
Step 1. Set custom content (sender)
Set the custom content for the notification bar message before sending the message.
sendMessage()
method in the ChatProvider.java class in the TUIKit:OfflineMessageContainerBean containerBean = new OfflineMessageContainerBean();
OfflineMessageBean entity = new OfflineMessageBean();
entity.content = message.getExtra().toString();
entity.sender = message.getFromUser();
entity.nickname = chatInfo.getChatName();
entity.faceUrl = TUIChatConfigs.getConfigs().getGeneralConfig().getUserFaceUrl();
containerBean.entity = entity;
V2TIMOfflinePushInfo v2TIMOfflinePushInfo = new V2TIMOfflinePushInfo();
v2TIMOfflinePushInfo.setExt(new Gson().toJson(containerBean).getBytes());
// For OPPO, you must set the `ChannelID` to receive push messages. The `ChannelID` must be consistent with that in the console.
v2TIMOfflinePushInfo.setAndroidOPPOChannelID("tuikit");
V2TIMManager.getMessageManager().sendMessage(v2TIMMessage, userID, null,
V2TIMMessage.V2TIM_PRIORITY_DEFAULT, false, v2TIMOfflinePushInfo, new V2TIMSendCallback<v2timmessage>() {
@Override
public void onError(int code, String desc) {}
@Override
public void onSuccess(V2TIMMessage v2TIMMessage) {}
@Override
public void onProgress(int progress) {}
});
Step 2. Set custom content (receiver)
Activity
when the notification bar message is clicked. You can refer to the parseOfflineMessage(Intent intent) implementation method in the OfflineMessageDispatcher.java class.Bundle bundle = getIntent().getExtras();
String value = bundle.getString("ext");
Refer to How to enable OPPO Push for instructions on how to enable OPPO Push. Go to OPPO push platform > Configuration Management > App Configuration to view detailed app information. Take note of AppId
, AppKey
, AppSecret
, and MasterSecret
.
The official OPPO documentation states that ChannelIDs are required for push messages on OPPO Android 8.0 and above. Therefore, create a ChannelID for your app. Below is a sample code that creates a ChannelID called tuikit
:
public void createNotificationChannel(Context context) {
// Create the NotificationChannel, but only on API 26+ because
// the NotificationChannel class is new and not in the support library
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence name = "oppotest";
String description = "this is opptest";
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel channel = new NotificationChannel("tuikit", name, importance);
channel.setDescription(description);
// Register the channel with the system; you can't change the importance
// or other notification behaviors after this
NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}
}
Log in to the IM console and click the target app card to go to the basic configuration page of the app. Click Add Certificate under Android Platform Push Settings. Use the information you obtained in step 1 to configure the following parameters:
ID
of the certificate. Certificate information takes effect within 10 minutes after you save it.HeytapPushManager.register(…)
in the OPPO SDK to initialize the Opush service.regId
in the onRegister
callback method of ICallBackResultService
. regId
is the unique identifier of the current app on the current device. After successful login to the IM SDK, you need to call setOfflinePushConfig to report the certificate ID and regId to the IM server.After the certificate ID and regId are successfully sent, the IM server will push the notification to the client through OPPO PUSH when the app is killed by the system before the user logs out.
You can select one of the following events: Open app, Open webpage, or Open specified in-app page.
This is the default event, which opens the app once the notification bar message is clicked.
You need to select Open webpage when adding a certificate and enter a URL that starts with either http
or https
, such as https://intl.cloud.tencent.com/document/product/269?from_cn_redirect=1
.
These are the ways you can open a specific in-app interface:
Activity (recommended)
This is rather simple. Enter the whole name of an Activity, such as com.tencent.qcloud.tim.demo.main.MainActivity
.
Intent action
In AndroidManifest, set the following configuration in the Activity to be opened and add category without data. You can refer to AndroidManifest.xml of the demo:
<intent-filter>
<action android:name="android.intent.action.VIEW">
<category android:name="android.intent.category.DEFAULT">
</category></action></intent-filter>
Enter android.intent.action.VIEW
in the console.
Select Open app or Open specified in-app page in Response after Click when adding a certificate to support custom content pass through.
Step 1. Set custom content (sender)
Set the custom content for the notification bar message before sending the message.
Below is a simple example on the Android platform. You can also refer to the corresponding logic in the sendMessage()
method in the ChatProvider.java class in the TUIKit:
OfflineMessageContainerBean containerBean = new OfflineMessageContainerBean();
OfflineMessageBean entity = new OfflineMessageBean();
entity.content = message.getExtra().toString();
entity.sender = message.getFromUser();
entity.nickname = chatInfo.getChatName();
entity.faceUrl = TUIChatConfigs.getConfigs().getGeneralConfig().getUserFaceUrl();
containerBean.entity = entity;
V2TIMOfflinePushInfo v2TIMOfflinePushInfo = new V2TIMOfflinePushInfo();
v2TIMOfflinePushInfo.setExt(new Gson().toJson(containerBean).getBytes());
// For OPPO, you must set the `ChannelID` to receive push messages. The `ChannelID` must be consistent with that in the console.
v2TIMOfflinePushInfo.setAndroidOPPOChannelID("tuikit");
V2TIMManager.getMessageManager().sendMessage(v2TIMMessage, userID, null,
V2TIMMessage.V2TIM_PRIORITY_DEFAULT, false, v2TIMOfflinePushInfo, new V2TIMSendCallback<v2timmessage>() {
@Override
public void onError(int code, String desc) {}
@Override
public void onSuccess(V2TIMMessage v2TIMMessage) {}
@Override
public void onProgress(int progress) {}
});
For information on configurations for the IM server, refer to the OfflinePushInfo Format Example.
Step 2. Set custom content (receiver)
When the notification bar message is clicked, the client can obtain the custom content from the launched Activity
. You can refer to the parseOfflineMessage(Intent intent)
implementation method in the OfflineMessageDispatcher.java class.
Bundle bundle = intent.getExtras();
Set<string> set = bundle.keySet();
if (set != null) {
for (String key : set) {
// `key` and `value` correspond to `extKey` and `ext content` set at the sender
String value = bundle.getString(key);
Log.i("oppo push custom data", "key = " + key + ":value = " + value);
}
}
PushClient.getInstance(getApplicationContext()).initialize()
to initialize the vivo Push service and call PushClient.getInstance(getApplicationContext()).turnOnPush()
to launch push. If this succeeds, you will receive the regId
in the onReceiveRegId
of the custom BroadcastReceiver
. regId
is the unique identifier of the current app on the current device. After successful login to the IM SDK, you need to call setOfflinePushConfig to report the certificate ID and regId to the IM server.After the certificate ID and regId are successfully reported, the IM server sends messages via vivo Push notifications to the user when the app has been killed but the user has not logged out of IM.
You can select one of the following events: Open app, Open webpage, or Open specified in-app page.
This is the default event, which opens the app once the notification bar message is clicked.
You need to select Open webpage when adding a certificate and enter a URL that starts with either http://
or https://
, such as https://intl.cloud.tencent.com/document/product/269?from_cn_redirect=1
.
intent-filter
of the Activity to be opened. See the sample code below. You can refer to AndroidManifest.xml of the demo:<activity android:name="com.tencent.qcloud.tim.demo.main.MainActivity" android:launchmode="singleTask" android:screenorientation="portrait" android:windowsoftinputmode="adjustResize|stateHidden">
<intent-filter>
<action android:name="android.intent.action.VIEW">
<data android:host="com.tencent.qcloud.tim" android:path="/detail" android:scheme="pushscheme">
</data></action></intent-filter>
</activity>
Obtain the intent URL, as shown below:
Intent intent = new Intent(this, MainActivity.class);
intent.setData(Uri.parse("pushscheme://com.tencent.qcloud.tim/detail"));
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
String intentUri = intent.toUri(Intent.URI_INTENT_SCHEME);
Log.i(TAG, "intentUri = " + intentUri);
intent://com.tencent.qcloud.tim/detail#Intent;scheme=pushscheme;launchFlags=0x4000000;component=com.tencent.qcloud.tim.tuikit/com.tencent.qcloud.tim.demo.main.MainActivity;end
Select Open specified in-app page when adding a certificate and enter the result above.
Select Open app or Open specified in-app page in Response after Click when adding a certificate to support custom content pass through.
Step 1. Set custom content (sender)
Set the custom content for the notification bar message before sending the message.
Below is a simple example on the Android platform. You can also refer to the corresponding logic in the sendMessage()
method in the ChatProvider.java class in the TUIKit:
OfflineMessageContainerBean containerBean = new OfflineMessageContainerBean();
OfflineMessageBean entity = new OfflineMessageBean();
entity.content = message.getExtra().toString();
entity.sender = message.getFromUser();
entity.nickname = chatInfo.getChatName();
entity.faceUrl = TUIChatConfigs.getConfigs().getGeneralConfig().getUserFaceUrl();
containerBean.entity = entity;
V2TIMOfflinePushInfo v2TIMOfflinePushInfo = new V2TIMOfflinePushInfo();
v2TIMOfflinePushInfo.setExt(new Gson().toJson(containerBean).getBytes());
// For OPPO, you must set the `ChannelID` to receive push messages. The `ChannelID` must be consistent with that in the console.
v2TIMOfflinePushInfo.setAndroidOPPOChannelID("tuikit");
V2TIMManager.getMessageManager().sendMessage(v2TIMMessage, userID, null,
V2TIMMessage.V2TIM_PRIORITY_DEFAULT, false, v2TIMOfflinePushInfo, new V2TIMSendCallback<v2timmessage>() {
@Override
public void onError(int code, String desc) {}
@Override
public void onSuccess(V2TIMMessage v2TIMMessage) {}
@Override
public void onProgress(int progress) {}
});
For information on configurations for the IM server, refer to the OfflinePushInfo Format Example.
Step 2. Set custom content (receiver)
When the notification bar message is clicked, the onNotificationMessageClicked(Context context, UPSNotificationMessage upsNotificationMessage)
callback of the vivo Push SDK is triggered. The custom content can be obtained from upsNotificationMessage
. You can refer to the parsing implementation in VIVOPushMessageReceiverImpl.java.
Map<string, string=""> paramMap = upsNotificationMessage.getParams();
String extContent = paramMap.get("ext");
app package name
, App ID
, and App Secret
.ID
of the certificate. Certificate information takes effect within 10 minutes after you save it.PushManager.register
to initialize the Meizu Push service. After successful registration, you will receive the registration result in onRegisterStatus
of the custom BroadcastReceiver
. registerStatus.getPushId()
is the unique identifier of the current app on the current device. After successful login to the IM SDK, you need to call setOfflinePushConfig to report the certificate ID and PushId to the IM server.After the certificate ID and regId are successfully reported, the IM server sends messages via Meizu Push notifications to the user when the app has been killed but the user has not logged out of IM.
You can select one of the following events: Open app, Open webpage, or Open specified in-app page.
This is the default event, which opens the app once the notification bar message is clicked.
You need to select Open webpage when adding a certificate and enter a URL that starts with either http://
or https://
, such as https://intl.cloud.tencent.com/document/product/269?from_cn_redirect=1
.
When adding a certificate, you need to choose Open specified in-app page and enter the complete class name of the Activity to be opened, for example, com.tencent.qcloud.tim.demo.main.MainActivity
.
Select Open app or Open specified in-app page in Response after Click when adding a certificate to support custom content pass through.
Step 1. Set custom content (sender)
Set the custom content for the notification bar message before sending the message.
sendMessage()
method in the ChatProvider.java class in the TUIKit:OfflineMessageContainerBean containerBean = new OfflineMessageContainerBean();
OfflineMessageBean entity = new OfflineMessageBean();
entity.content = message.getExtra().toString();
entity.sender = message.getFromUser();
entity.nickname = chatInfo.getChatName();
entity.faceUrl = TUIChatConfigs.getConfigs().getGeneralConfig().getUserFaceUrl();
containerBean.entity = entity;
V2TIMOfflinePushInfo v2TIMOfflinePushInfo = new V2TIMOfflinePushInfo();
v2TIMOfflinePushInfo.setExt(new Gson().toJson(containerBean).getBytes());
// For OPPO, you must set the `ChannelID` to receive push messages. The `ChannelID` must be consistent with that in the console.
v2TIMOfflinePushInfo.setAndroidOPPOChannelID("tuikit");
V2TIMManager.getMessageManager().sendMessage(v2TIMMessage, userID, null,
V2TIMMessage.V2TIM_PRIORITY_DEFAULT, false, v2TIMOfflinePushInfo, new V2TIMSendCallback<v2timmessage>() {
@Override
public void onError(int code, String desc) {}
@Override
public void onSuccess(V2TIMMessage v2TIMMessage) {}
@Override
public void onProgress(int progress) {}
});
Step 2. Set custom content (receiver)
Clicking a notification bar message triggers a callback of onNotificationClicked(Context context, MzPushMessage mzPushMessage)
, which is part of the Meizu Push SDK. The custom content can be obtained from the value of mzPushMessage
.
String extContent = mzPushMessage.getSelfDefineContentString();
Alternatively, the client can obtain the custom content from the opened Activity
. You can refer to the parseOfflineMessage(Intent intent)
implementation method in the OfflineMessageDispatcher.java class.
Bundle bundle = getIntent().getExtras();
String extContent = bundle.getString("ext");
ID
of the certificate. Certificate information takes effect within 10 minutes after you save it.FirebaseInstanceId.getInstance().getInstanceId()
, you can obtain the token in the callback. The token is the unique identifier of the current app. After successful login to the IM SDK, you need to call setOfflinePushConfig to report the certificate ID and token to the IM server.After the certificate ID and regId are successfully reported, the IM server sends messages via FCM Push notifications to the user when the app has been killed but the user has not logged out of IM.
Step 1. Set custom content (sender)
Set the custom content for the notification bar message before sending the message.
sendMessage()
method in the ChatProvider.java class in the TUIKit:OfflineMessageContainerBean containerBean = new OfflineMessageContainerBean();
OfflineMessageBean entity = new OfflineMessageBean();
entity.content = message.getExtra().toString();
entity.sender = message.getFromUser();
entity.nickname = chatInfo.getChatName();
entity.faceUrl = TUIChatConfigs.getConfigs().getGeneralConfig().getUserFaceUrl();
containerBean.entity = entity;
V2TIMOfflinePushInfo v2TIMOfflinePushInfo = new V2TIMOfflinePushInfo();
v2TIMOfflinePushInfo.setExt(new Gson().toJson(containerBean).getBytes());
// For OPPO, you must set the `ChannelID` to receive push messages. The `ChannelID` must be consistent with that in the console.
v2TIMOfflinePushInfo.setAndroidOPPOChannelID("tuikit");
V2TIMManager.getMessageManager().sendMessage(v2TIMMessage, userID, null,
V2TIMMessage.V2TIM_PRIORITY_DEFAULT, false, v2TIMOfflinePushInfo, new V2TIMSendCallback<v2timmessage>() {
@Override
public void onError(int code, String desc) {}
@Override
public void onSuccess(V2TIMMessage v2TIMMessage) {}
@Override
public void onProgress(int progress) {}
});
Step 2. Set custom content (receiver)
When the notification bar message is clicked, the client can obtain the custom content from the corresponding Activity
. You can refer to the parseOfflineMessage(Intent intent)
implementation method in the OfflineMessageDispatcher.java class.
Bundle bundle = getIntent().getExtras();
String value = bundle.getString("ext");
When calling sendMessage to send messages, use the setIOSSound API in V2TIMOfflinePushInfo
to set the sound for push notifications on iOS devices.
When calling sendMessage to send messages, use setTitle and setDesc in V2TIMOfflinePushInfo
to set the title and content of notification bar messages respectively.
Currently, most vendors do not support setting a custom sound for push notifications, therefore it is not supported by the IM SDK.
This generally occurs for the following reasons:
The offline push for custom messages is different from that for ordinary messages. As we cannot parse the content of custom messages, the push content cannot be determined. Therefore, by default, custom messages are not pushed offline. If you need offline push for custom messages, you need to set the desc field in offlinePushInfo during sendMessage, and the desc
information will be displayed by default during push.
To disable the receiving of offline push messages, set the config
parameter of the setOfflinePushConfig API to null
. This feature is supported from v5.6.1200.
Was this page helpful?