VibrateType
enum 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" />
Content copied to clipboard
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);
}
}
Content copied to clipboard
See also
Entries
Functions
Link copied to clipboard
Link copied to clipboard
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
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.