isSilent
Checks if this is a silent (data-only) push notification.
Silent pushes do not display notifications to the user but can trigger background processing in your app. Use this to deliver data updates, sync content, or perform background tasks without interrupting the user. Example:
protected boolean onMessageReceived(PushMessage message) {
if (message.isSilent()) {
// Handle silent push - update data without notification
String customData = message.getCustomData();
try {
JSONObject data = new JSONObject(customData);
String action = data.optString("action");
if ("sync_messages".equals(action)) {
// Sync messages in background
syncMessagesFromServer();
} else if ("update_config".equals(action)) {
// Update app configuration
updateAppConfig(data);
}
Log.d("App", "Silent push processed: " + action);
} catch (JSONException e) {
Log.e("App", "Failed to parse silent push data", e);
}
return true; // Already handled, don't show notification
}
return false; // Regular push, show notification
}
Content copied to clipboard
Return
true if this is a silent push that should not display a notification