NotificationChannel.VibrationEffect Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the VibrationEffect
for notifications posted to this channel. -or- Sets a VibrationEffect
for notifications posted to this channel.
public Android.OS.VibrationEffect? VibrationEffect { [Android.Runtime.Register("getVibrationEffect", "()Landroid/os/VibrationEffect;", "", ApiSince=35)] get; [Android.Runtime.Register("setVibrationEffect", "(Landroid/os/VibrationEffect;)V", "", ApiSince=35)] set; }
[<get: Android.Runtime.Register("getVibrationEffect", "()Landroid/os/VibrationEffect;", "", ApiSince=35)>]
[<set: Android.Runtime.Register("setVibrationEffect", "(Landroid/os/VibrationEffect;)V", "", ApiSince=35)>]
member this.VibrationEffect : Android.OS.VibrationEffect with get, set
Property Value
the VibrationEffect
set via #setVibrationEffect(VibrationEffect)
, or the equivalent of the
vibration set via #setVibrationPattern(long[])
.
- Attributes
Remarks
Property getter documentation:
Returns the VibrationEffect
for notifications posted to this channel. The returned effect is derived from either the effect provided in the #setVibrationEffect(VibrationEffect)
method, or the equivalent vibration effect of the pattern set via the #setVibrationPattern(long[])
method, based on setter method that was called last.
The returned effect will be ignored in one of the following cases: <ul> <li> vibration is not enabled for the channel (i.e. #shouldVibrate()
returns false
). <li> the effect is not supported/playable by the device. In this case, if vibration is enabled for the channel, the default channel vibration will be used instead. </ul>
Java documentation for android.app.NotificationChannel.getVibrationEffect()
.
Property setter documentation:
Sets a VibrationEffect
for notifications posted to this channel. If the provided effect is non-null, will enable vibration on this channel (equivalent to calling #enableVibration(boolean)
with true
). Otherwise vibration will be disabled unless #enableVibration(boolean)
is used with true
, in which case the default vibration will be used.
The effect passed here will be returned from #getVibrationEffect()
. If the provided VibrationEffect
is an equivalent to a wave-form vibration pattern, the equivalent wave-form pattern will be returned from #getVibrationPattern()
.
Note that some VibrationEffect
s may not be playable on some devices. In cases where such an effect is passed here, vibration will still be enabled for the channel, but the default vibration will be used. Nonetheless, the provided effect will be stored and be returned from #getVibrationEffect
calls, and could be used by the same channel on a different device, for example, in cases the user backs up and restores to a device that does have the ability to play the effect, where that effect will be used instead of the default. To avoid such issues that could make the vibration behavior of your notification channel differ among different devices, it's recommended that you avoid vibration effect primitives, as the support for them differs widely among devices (read VibrationEffect.Composition
for more on vibration primitives).
Only modifiable before the channel is submitted to NotificationManager#createNotificationChannel(NotificationChannel)
.
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.