VibrateType

Defines vibration behavior for push notifications.

VibrateType controls when the device vibrates for push notifications based on the device's ringer mode. This setting can be configured globally for all push notifications using setVibrateNotificationType.

Required Permission: Your application must declare the VIBRATE permission in AndroidManifest.xml for vibration to work:


<uses-permission android:name="android.permission.VIBRATE" />

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 vibration behavior
          PushwooshNotificationSettings settings =
              new PushwooshNotificationSettings();

          // Always vibrate for important notifications
          settings.setVibrateNotificationType(VibrateType.ALWAYS);

          // Or disable vibration completely
          // settings.setVibrateNotificationType(VibrateType.NO_VIBRATE);

          // Or use default system behavior
          // settings.setVibrateNotificationType(VibrateType.DEFAULT_MODE);
      }
  }

  // Example: User preference for vibration
  public void applyUserSettings(boolean userWantsVibration) {
      PushwooshNotificationSettings settings =
          new PushwooshNotificationSettings();

      if (userWantsVibration) {
          settings.setVibrateNotificationType(VibrateType.ALWAYS);
      } else {
          settings.setVibrateNotificationType(VibrateType.NO_VIBRATE);
      }
  }

  // Example: Different vibration for different notification types
  public void configureVibrateForMessageType(String messageType) {
      PushwooshNotificationSettings settings =
          new PushwooshNotificationSettings();

      if ("urgent".equals(messageType)) {
          // Critical messages always vibrate
          settings.setVibrateNotificationType(VibrateType.ALWAYS);
      } else {
          // Normal messages respect device settings
          settings.setVibrateNotificationType(VibrateType.DEFAULT_MODE);
      }
  }

See also

Entries

Link copied to clipboard

Vibration occurs only when device is in vibrate ringer mode.

Link copied to clipboard

Vibration is disabled for notifications.

Link copied to clipboard

Vibration always occurs for notifications.

Properties

Link copied to clipboard
val value: Int

Functions

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

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<VibrateType>

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.