You can use the offline push feature to allow users to receive 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 devices need you to register for offline message callbacks.
The 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 Format.
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 offline 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. For more information, see Customizing Offline Message Attributes to customize the extension field.
In some cases, an app needs to set the push alert sound of a single message to alert users. You can input the sound into the sound field in TIMCustomElem, and during push, the IM backend will input the field into Ext. For more information, see 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 continues to receive offline notifications. For more information, see Android Offline Push.