Share via


Vibrator.Vibrate Method

Definition

Overloads

Vibrate(VibrationEffect)

Vibrate with a given effect.

Vibrate(Int64)

Vibrate constantly for the specified period of time.

Vibrate(VibrationEffect, AudioAttributes)

Vibrate with a given effect.

Vibrate(VibrationEffect, VibrationAttributes)

Vibrate with a given effect.

Vibrate(Int64, AudioAttributes)

Vibrate constantly for the specified period of time.

Vibrate(Int64[], Int32)

Vibrate with a given pattern.

Vibrate(Int64[], Int32, AudioAttributes)

Vibrate with a given pattern.

Vibrate(VibrationEffect)

Vibrate with a given effect.

[Android.Runtime.Register("vibrate", "(Landroid/os/VibrationEffect;)V", "GetVibrate_Landroid_os_VibrationEffect_Handler", ApiSince=26)]
[Android.Runtime.RequiresPermission("android.permission.VIBRATE")]
public virtual void Vibrate (Android.OS.VibrationEffect? vibe);
[<Android.Runtime.Register("vibrate", "(Landroid/os/VibrationEffect;)V", "GetVibrate_Landroid_os_VibrationEffect_Handler", ApiSince=26)>]
[<Android.Runtime.RequiresPermission("android.permission.VIBRATE")>]
abstract member Vibrate : Android.OS.VibrationEffect -> unit
override this.Vibrate : Android.OS.VibrationEffect -> unit

Parameters

vibe
VibrationEffect

VibrationEffect describing the vibration to be performed.

Attributes

Remarks

Vibrate with a given effect.

The app should be in the foreground for the vibration to happen.

Java documentation for android.os.Vibrator.vibrate(android.os.VibrationEffect).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Vibrate(Int64)

Vibrate constantly for the specified period of time.

[Android.Runtime.Register("vibrate", "(J)V", "GetVibrate_JHandler")]
[Android.Runtime.RequiresPermission("android.permission.VIBRATE")]
public virtual void Vibrate (long milliseconds);
[<Android.Runtime.Register("vibrate", "(J)V", "GetVibrate_JHandler")>]
[<Android.Runtime.RequiresPermission("android.permission.VIBRATE")>]
abstract member Vibrate : int64 -> unit
override this.Vibrate : int64 -> unit

Parameters

milliseconds
Int64

The number of milliseconds to vibrate.

Attributes

Remarks

Vibrate constantly for the specified period of time.

The app should be in the foreground for the vibration to happen.

This member is deprecated. Use #vibrate(VibrationEffect) instead.

Java documentation for android.os.Vibrator.vibrate(long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Vibrate(VibrationEffect, AudioAttributes)

Vibrate with a given effect.

[Android.Runtime.Register("vibrate", "(Landroid/os/VibrationEffect;Landroid/media/AudioAttributes;)V", "GetVibrate_Landroid_os_VibrationEffect_Landroid_media_AudioAttributes_Handler", ApiSince=26)]
[Android.Runtime.RequiresPermission("android.permission.VIBRATE")]
public virtual void Vibrate (Android.OS.VibrationEffect? vibe, Android.Media.AudioAttributes? attributes);
[<Android.Runtime.Register("vibrate", "(Landroid/os/VibrationEffect;Landroid/media/AudioAttributes;)V", "GetVibrate_Landroid_os_VibrationEffect_Landroid_media_AudioAttributes_Handler", ApiSince=26)>]
[<Android.Runtime.RequiresPermission("android.permission.VIBRATE")>]
abstract member Vibrate : Android.OS.VibrationEffect * Android.Media.AudioAttributes -> unit
override this.Vibrate : Android.OS.VibrationEffect * Android.Media.AudioAttributes -> unit

Parameters

vibe
VibrationEffect

VibrationEffect describing the vibration to be performed.

attributes
AudioAttributes

AudioAttributes corresponding to the vibration. For example, specify AudioAttributes#USAGE_ALARM for alarm vibrations or AudioAttributes#USAGE_NOTIFICATION_RINGTONE for vibrations associated with incoming calls.

Attributes

Remarks

Vibrate with a given effect.

The app should be in the foreground for the vibration to happen. Background apps should specify a ringtone, notification or alarm usage in order to vibrate.

This member is deprecated. Use #vibrate(VibrationEffect, VibrationAttributes) instead.

Java documentation for android.os.Vibrator.vibrate(android.os.VibrationEffect, android.media.AudioAttributes).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Vibrate(VibrationEffect, VibrationAttributes)

Vibrate with a given effect.

[Android.Runtime.Register("vibrate", "(Landroid/os/VibrationEffect;Landroid/os/VibrationAttributes;)V", "GetVibrate_Landroid_os_VibrationEffect_Landroid_os_VibrationAttributes_Handler", ApiSince=33)]
[Android.Runtime.RequiresPermission("android.permission.VIBRATE")]
public virtual void Vibrate (Android.OS.VibrationEffect vibe, Android.OS.VibrationAttributes attributes);
[<Android.Runtime.Register("vibrate", "(Landroid/os/VibrationEffect;Landroid/os/VibrationAttributes;)V", "GetVibrate_Landroid_os_VibrationEffect_Landroid_os_VibrationAttributes_Handler", ApiSince=33)>]
[<Android.Runtime.RequiresPermission("android.permission.VIBRATE")>]
abstract member Vibrate : Android.OS.VibrationEffect * Android.OS.VibrationAttributes -> unit
override this.Vibrate : Android.OS.VibrationEffect * Android.OS.VibrationAttributes -> unit

Parameters

vibe
VibrationEffect

VibrationEffect describing the vibration to be performed.

attributes
VibrationAttributes

VibrationAttributes corresponding to the vibration. For example, specify VibrationAttributes#USAGE_ALARM for alarm vibrations or VibrationAttributes#USAGE_RINGTONE for vibrations associated with incoming calls.

Attributes

Remarks

Vibrate with a given effect.

The app should be in the foreground for the vibration to happen. Background apps should specify a ringtone, notification or alarm usage in order to vibrate.

Java documentation for android.os.Vibrator.vibrate(android.os.VibrationEffect, android.os.VibrationAttributes).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Vibrate(Int64, AudioAttributes)

Vibrate constantly for the specified period of time.

[Android.Runtime.Register("vibrate", "(JLandroid/media/AudioAttributes;)V", "GetVibrate_JLandroid_media_AudioAttributes_Handler")]
[Android.Runtime.RequiresPermission("android.permission.VIBRATE")]
public virtual void Vibrate (long milliseconds, Android.Media.AudioAttributes? attributes);
[<Android.Runtime.Register("vibrate", "(JLandroid/media/AudioAttributes;)V", "GetVibrate_JLandroid_media_AudioAttributes_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.VIBRATE")>]
abstract member Vibrate : int64 * Android.Media.AudioAttributes -> unit
override this.Vibrate : int64 * Android.Media.AudioAttributes -> unit

Parameters

milliseconds
Int64

The number of milliseconds to vibrate.

attributes
AudioAttributes

AudioAttributes corresponding to the vibration. For example, specify AudioAttributes#USAGE_ALARM for alarm vibrations or AudioAttributes#USAGE_NOTIFICATION_RINGTONE for vibrations associated with incoming calls.

Attributes

Remarks

Vibrate constantly for the specified period of time.

The app should be in the foreground for the vibration to happen. Background apps should specify a ringtone, notification or alarm usage in order to vibrate.

This member is deprecated. Use #vibrate(VibrationEffect, VibrationAttributes) instead.

Java documentation for android.os.Vibrator.vibrate(long, android.media.AudioAttributes).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Vibrate(Int64[], Int32)

Vibrate with a given pattern.

[Android.Runtime.Register("vibrate", "([JI)V", "GetVibrate_arrayJIHandler")]
[Android.Runtime.RequiresPermission("android.permission.VIBRATE")]
public virtual void Vibrate (long[]? pattern, int repeat);
[<Android.Runtime.Register("vibrate", "([JI)V", "GetVibrate_arrayJIHandler")>]
[<Android.Runtime.RequiresPermission("android.permission.VIBRATE")>]
abstract member Vibrate : int64[] * int -> unit
override this.Vibrate : int64[] * int -> unit

Parameters

pattern
Int64[]

an array of longs of times for which to turn the vibrator on or off.

repeat
Int32

the index into pattern at which to repeat, or -1 if you don't want to repeat.

Attributes

Remarks

Vibrate with a given pattern.

Pass in an array of ints that are the durations for which to turn on or off the vibrator in milliseconds. The first value indicates the number of milliseconds to wait before turning the vibrator on. The next value indicates the number of milliseconds for which to keep the vibrator on before turning it off. Subsequent values alternate between durations in milliseconds to turn the vibrator off or to turn the vibrator on.

To cause the pattern to repeat, pass the index into the pattern array at which to start the repeat, or -1 to disable repeating.

The app should be in the foreground for the vibration to happen.

This member is deprecated. Use #vibrate(VibrationEffect) instead.

Java documentation for android.os.Vibrator.vibrate(long[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Vibrate(Int64[], Int32, AudioAttributes)

Vibrate with a given pattern.

[Android.Runtime.Register("vibrate", "([JILandroid/media/AudioAttributes;)V", "GetVibrate_arrayJILandroid_media_AudioAttributes_Handler")]
[Android.Runtime.RequiresPermission("android.permission.VIBRATE")]
public virtual void Vibrate (long[]? pattern, int repeat, Android.Media.AudioAttributes? attributes);
[<Android.Runtime.Register("vibrate", "([JILandroid/media/AudioAttributes;)V", "GetVibrate_arrayJILandroid_media_AudioAttributes_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.VIBRATE")>]
abstract member Vibrate : int64[] * int * Android.Media.AudioAttributes -> unit
override this.Vibrate : int64[] * int * Android.Media.AudioAttributes -> unit

Parameters

pattern
Int64[]

an array of longs of times for which to turn the vibrator on or off.

repeat
Int32

the index into pattern at which to repeat, or -1 if you don't want to repeat.

attributes
AudioAttributes

AudioAttributes corresponding to the vibration. For example, specify AudioAttributes#USAGE_ALARM for alarm vibrations or AudioAttributes#USAGE_NOTIFICATION_RINGTONE for vibrations associated with incoming calls.

Attributes

Remarks

Vibrate with a given pattern.

Pass in an array of ints that are the durations for which to turn on or off the vibrator in milliseconds. The first value indicates the number of milliseconds to wait before turning the vibrator on. The next value indicates the number of milliseconds for which to keep the vibrator on before turning it off. Subsequent values alternate between durations in milliseconds to turn the vibrator off or to turn the vibrator on.

To cause the pattern to repeat, pass the index into the pattern array at which to start the repeat, or -1 to disable repeating.

The app should be in the foreground for the vibration to happen. Background apps should specify a ringtone, notification or alarm usage in order to vibrate.

This member is deprecated. Use #vibrate(VibrationEffect, VibrationAttributes) instead.

Java documentation for android.os.Vibrator.vibrate(long[], int, android.media.AudioAttributes).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to