shouldGenerateSummaryNotification
Controls whether summary notifications should be generated at all.
Override this method to conditionally enable or disable summary notification creation based on app state, user preferences, or other criteria. When this returns false, individual grouped notifications will still appear, but no summary notification will be shown.
This is useful for scenarios where you want to disable grouping temporarily without changing the AndroidManifest configuration. Example - Conditional summary based on preferences:
public boolean shouldGenerateSummaryNotification() {
SharedPreferences prefs = getApplicationContext()
.getSharedPreferences("app_prefs", Context.MODE_PRIVATE);
return prefs.getBoolean("enable_grouped_notifications", true);
}
Content copied to clipboard
public boolean shouldGenerateSummaryNotification() {
// Don't show summary during first-time user experience
SharedPreferences prefs = getApplicationContext()
.getSharedPreferences("onboarding", Context.MODE_PRIVATE);
return prefs.getBoolean("onboarding_completed", false);
}
Content copied to clipboard
Return
true to generate summary notifications (default), false to disable summary creation