SoundType
enum SoundType
Defines sound playback behavior for push notifications.
SoundType controls when notification sounds are played based on the device's ringer mode. This setting can be configured globally for all push notifications using setSoundNotificationType.
Usage Example:
// In your Application class or initialization code
public class MyApplication extends Application {
public void onCreate() {
super.onCreate();
// Initialize Pushwoosh
Pushwoosh.getInstance().registerForPushNotifications();
// Configure notification sound behavior
PushwooshNotificationSettings settings =
new PushwooshNotificationSettings();
// Always play sound for important notifications
settings.setSoundNotificationType(SoundType.ALWAYS);
// Or disable sound completely for silent app
// settings.setSoundNotificationType(SoundType.NO_SOUND);
// Or use default system behavior
// settings.setSoundNotificationType(SoundType.DEFAULT_MODE);
}
}
// Example: Different sound settings for different app modes
public void updateNotificationSettings(boolean isWorkingHours) {
PushwooshNotificationSettings settings =
new PushwooshNotificationSettings();
if (isWorkingHours) {
// Silent during work hours
settings.setSoundNotificationType(SoundType.NO_SOUND);
} else {
// Sound enabled after hours
settings.setSoundNotificationType(SoundType.ALWAYS);
}
}
Content copied to clipboard