PushwooshNotificationSettings
Provides global configuration for push notification appearance and behavior.
PushwooshNotificationSettings allows you to customize how push notifications are displayed across your entire application. Settings configured here apply to all push notifications received by the app, unless overridden by individual notification settings from the Pushwoosh Control Panel.
Key Features:
- Notification Display Mode - Single or multiple notifications in tray
- Sound Settings - Control when notification sounds play
- Vibration Settings - Control when device vibrates
- Visual Customization - LED color, icon background color, screen wake
- Notification Channel - Configure Android O+ notification channel name
- Enable/Disable - Turn notifications on/off programmatically
Basic Configuration Example:
public class MyApplication extends Application {
public void onCreate() {
super.onCreate();
// Initialize Pushwoosh first
Pushwoosh.getInstance().registerForPushNotifications();
// Configure notification appearance
PushwooshNotificationSettings.setMultiNotificationMode(true);
PushwooshNotificationSettings.setSoundNotificationType(SoundType.ALWAYS);
PushwooshNotificationSettings.setVibrateNotificationType(VibrateType.DEFAULT_MODE);
PushwooshNotificationSettings.setEnableLED(true);
PushwooshNotificationSettings.setColorLED(Color.BLUE);
}
}
Content copied to clipboard
E-commerce App Example - Custom Branding:
public class ShoppingApplication extends Application {
public void onCreate() {
super.onCreate();
Pushwoosh.getInstance().registerForPushNotifications();
// Brand colors for notifications
int brandColor = ContextCompat.getColor(this, R.color.brand_primary);
PushwooshNotificationSettings.setNotificationIconBackgroundColor(brandColor);
PushwooshNotificationSettings.setColorLED(brandColor);
PushwooshNotificationSettings.setEnableLED(true);
// Multiple notifications for order updates
PushwooshNotificationSettings.setMultiNotificationMode(true);
// Always alert for important updates
PushwooshNotificationSettings.setSoundNotificationType(SoundType.ALWAYS);
PushwooshNotificationSettings.setVibrateNotificationType(VibrateType.ALWAYS);
PushwooshNotificationSettings.setLightScreenOnNotification(true);
// Android O+ notification channel
PushwooshNotificationSettings.setNotificationChannelName("Order Updates");
}
}
Content copied to clipboard
Productivity App Example - User Preferences:
public class FocusApplication extends Application {
public void onCreate() {
super.onCreate();
Pushwoosh.getInstance().registerForPushNotifications();
// Load user preferences
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean focusModeEnabled = prefs.getBoolean("focus_mode", false);
if (focusModeEnabled) {
// Silent notifications during focus mode
PushwooshNotificationSettings.setSoundNotificationType(SoundType.NO_SOUND);
PushwooshNotificationSettings.setVibrateNotificationType(VibrateType.NO_VIBRATE);
PushwooshNotificationSettings.setEnableLED(false);
} else {
// Normal notifications
PushwooshNotificationSettings.setSoundNotificationType(SoundType.DEFAULT_MODE);
PushwooshNotificationSettings.setVibrateNotificationType(VibrateType.DEFAULT_MODE);
PushwooshNotificationSettings.setEnableLED(true);
}
}
}
// Update settings when user toggles focus mode
public void onFocusModeChanged(boolean enabled) {
if (enabled) {
PushwooshNotificationSettings.setSoundNotificationType(SoundType.NO_SOUND);
PushwooshNotificationSettings.setVibrateNotificationType(VibrateType.NO_VIBRATE);
} else {
PushwooshNotificationSettings.setSoundNotificationType(SoundType.DEFAULT_MODE);
PushwooshNotificationSettings.setVibrateNotificationType(VibrateType.DEFAULT_MODE);
}
}
Content copied to clipboard
Important Notes:
- All methods are static and apply settings globally across the app
- Settings persist across app restarts
- Pushwoosh must be initialized before calling these methods
- Individual notification settings from Pushwoosh Control Panel can override these defaults
- LED customization requires VIBRATE permission
- For Android O (API 26+), use setNotificationChannelName to set channel name
See also
Functions
Link copied to clipboard
Checks if push notifications are currently enabled.
Link copied to clipboard
Enables or disables push notifications for the app.
Link copied to clipboard
Link copied to clipboard
Sets the LED notification color.
Link copied to clipboard
Enables or disables LED blinking for notifications.
Link copied to clipboard
Enables or disables screen wake-up when notification arrives.
Link copied to clipboard
Enables or disables multi-notification mode.
Link copied to clipboard
Sets the notification channel name for Android O (API 26) and above.
Link copied to clipboard
Sets the background color for the notification icon.
Link copied to clipboard
Configures when notification sounds should play.
Link copied to clipboard
Configures when device should vibrate for notifications.