You can use the offline push feature to notify users upon the arrival of new messages even when the app is running in the background or the process has been killed. iOS devices use APNs for offline push, while Android users need to register for offline message callbacks.
Instant Messaging (IM) supports Apple APNS push, Xiaomi push, Huawei push, Meizu push, Vivo push, OPPO push, and Google FCM push. The vendor channels used in the IM Demo are provided and maintained by TPNS in a unified manner. If you need to integrate the offline push feature, you can integrate the TPNS service or integrate the offline push service of the desired vendor:
The preceding figure shows the examples of a one-to-one chat message and group chat message.
For more information about iOS APNs push formats, see Push Formats.
The following APIs must be called to support APNs. For more information, see iOS APNs Event Reporting:
In some cases, an app needs to set the Ext extension field for push based on specific circumstances to facilitate user operations such as redirect clicks. You can input it into the Ext field in TIMCustomElem, and during push, the IM backend will input the field into Ext. Please refer to Customizing Offline Message Attributes to customize the extension field.
In some cases, an app needs to set the push sound of a single message to alert the user. You can input the sound into the sound field in TIMCustomElem, and during push, the IM backend will input the field into Ext. Please refer to Setting Custom Push Alert Sounds.
Android 1.8.0 and later versions support separating services from processes. When the app process is killed, the service survives and can continue to receive offline push notifications. For more information about the relevant settings and configuration, see Android Offline Push.
For iOS, you can refer to Push Formats to set the display format of APNs push messages; for Android, you can refer to Offline Push OfflinePushInfo to set the display format.
Was this page helpful?