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);
      }
  }

See also

Entries

Link copied to clipboard

Sound is played only when device is in normal ringer mode.

Link copied to clipboard

Sound is never played for notifications.

Link copied to clipboard

Sound is always played for notifications.

Properties

Link copied to clipboard
val value: Int

Functions

Link copied to clipboard
open fun fromInt(x: Int): SoundType
Link copied to clipboard
open fun valueOf(name: String): SoundType

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard
open fun values(): Array<SoundType>

Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants.