setShowPushnotificationAlert

Controls whether system notifications are suppressed when the app is in the foreground.

When set to true, push notifications received while the app is in the foreground will not produce a system notification. The push data is still delivered to the SDK and any registered com.pushwoosh.notification.NotificationServiceExtension callbacks. By default this is false, meaning notifications are displayed normally regardless of the app state.

This can also be configured declaratively in AndroidManifest.xml without any Java code:


<meta-data
    android:name="com.pushwoosh.foreground_push"
    android:value="true" />
The manifest value serves as the initial default; calling this method at runtime overrides it.

Example:


// Suppress foreground notifications at runtime
Pushwoosh.getInstance().setShowPushnotificationAlert(true);

// Re-enable foreground notifications
Pushwoosh.getInstance().setShowPushnotificationAlert(false);

Parameters

showAlert

true to suppress system notifications when the app is in the foreground, false to display them normally (default)

See also