How to Prevent Messages from Being Collapsed
In mobile app push notification scenarios, message collapsing directly affects the user experience and message delivery efficiency. Based on the AppPush product, this article explains in detail how to achieve non-collapsed message display through technical configuration, covering both Notification and Custom Message types.

1. Comparison of Message Types and Display Rules
Notification
- System default behavior:
| App Status | Display Rule |
|---|---|
| Running in foreground | Collapse logic can be controlled through group_id |
| Running in background | Handled by the mobile operating system. By default, messages appear in the notification bar, and the display format is restricted (such as collapsing, quantity limits, etc.), making custom styling difficult. |
- Applicable scenarios: Standard push notifications that need to reach users through the system notification bar.
Custom Message
Core advantage:
Whether the app is in the foreground, background, or has been cleared with one tap, the message display format can be fully controlled through client-side code, including popup position and collapse logic.Applicable scenarios:
High-priority messages that require customized interaction, such as order status reminders and instant chat messages.
2. Two Solutions to Prevent Messages from Being Collapsed
Solution 1: Using Notification
(For the FCM channel, the app must be in the foreground; the EngageLab channel does not distinguish between foreground and background.)
Implementation principle
Use the group_id field to control message grouping logic:
- No collapsing: assign a unique
group_idto each message.
Steps
Supported versions: Android SDK V5.0.1 and later
Example of push API parameter configuration (request body):
{
"notification": {
"android": {
"group_id": "UNIQUE_GROUP_123" // Use a unique value to prevent collapsing
}
}
}
Compatibility notes
- Only FCM and EngageLab push channels are supported.
- If the app is running in the background, message display is still subject to system restrictions.
Solution 2: Using Custom Message (Supported in All Scenarios)
Implementation principle
Actively call the showNotification API on the client side to fully control the message rendering logic and avoid system restrictions.
Steps
1. Send a custom message
{
"message": {
"msg_content": "Your order has been shipped",
"content_type": "text",
"extras": {
"type": "priority_alert",
"style": "popup_bottom" // Custom display style
}
}
}
2. Process the message on the client side (Android example)
public class UserReceiver extends MTCommonReceiver {
@Override
public void onCustomMessage(Context context, CustomMessage customMessage) {
ExampleLogger.i(TAG, "onCustomMessage:" + customMessage.toString());
showNotification(context, customMessage); // Call display logic
}
}
3. Example of custom display logic (to prevent collapsing)
public void showNotification(Context context, CustomMessage customMessage) {
NotificationMessage notificationMessage = new NotificationMessage()
.setMessageId(customMessage.getMessageId())
.setNotificationId("Define this yourself, but make sure each notification is different")
.setTitle(customMessage.getTitle())
.setContent(customMessage.getContent())
.setgroup_id(customMessage.getMessageId()); // Key field for preventing collapsing
MTPushPrivatesApi.showNotification(context, notificationMessage);
}
Advantage Comparison
| Capability | Notification | Custom Message |
|---|---|---|
| Supported app status | FCM: foreground only; EngageLab: foreground and background | All scenarios (foreground/background) |
| Style flexibility | Limited (system-dependent) | Fully customizable |
| Channel dependency | Requires specific channels (FCM, EngageLab) | No restriction |
3. Notes
Channel compatibility
- The
group_idfeature currently supports only FCM and EngageLab channels. Other channels are not supported at this time.
- The
Performance optimization
- When sending messages frequently with independent
group_idvalues, monitor notification bar cache pressure on the system side (recommended: ≤30 messages per device per hour).
- When sending messages frequently with independent
4. Summary
- Lightweight requirements: Prefer using
group_idto control notification collapse logic, as it has a lower development cost. - Highly customized requirements: Choose the custom message solution to achieve fully controllable display across all scenarios through client-side code.
- Hybrid strategy: Use custom messages for important notifications (such as payment confirmations), and use
group_idmanagement for regular notifications.
By choosing the appropriate solution, you can significantly improve the delivery rate of critical messages and enhance the user interaction experience.










