View.PerformHapticFeedback Method
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.
Overloads
| Name | Description |
|---|---|
| PerformHapticFeedback(HapticFeedbackRequest) |
Like performHapticFeedback(int, int), but takes a HapticFeedbackRequest. |
| PerformHapticFeedback(FeedbackConstants) |
BZZZTT!!1! |
| PerformHapticFeedback(FeedbackConstants, FeedbackFlags) |
BZZZTT!!1! |
PerformHapticFeedback(HapticFeedbackRequest)
Like performHapticFeedback(int, int), but takes a HapticFeedbackRequest.
[Android.Runtime.Register("performHapticFeedback", "(Landroid/os/vibrator/HapticFeedbackRequest;)Z", "GetPerformHapticFeedback_Landroid_os_vibrator_HapticFeedbackRequest_Handler", ApiSince=36)]
public virtual bool PerformHapticFeedback(Android.OS.Vibrators.HapticFeedbackRequest request);
[<Android.Runtime.Register("performHapticFeedback", "(Landroid/os/vibrator/HapticFeedbackRequest;)Z", "GetPerformHapticFeedback_Landroid_os_vibrator_HapticFeedbackRequest_Handler", ApiSince=36)>]
abstract member PerformHapticFeedback : Android.OS.Vibrators.HapticFeedbackRequest -> bool
override this.PerformHapticFeedback : Android.OS.Vibrators.HapticFeedbackRequest -> bool
Parameters
- request
- HapticFeedbackRequest
the HapticFeedbackRequest encapsulating the request for haptic. This value cannot be null.
Returns
false if isHapticFeedbackEnabled() is false, or this View is not attached to a visible window, or the vibration usage in the provided request is not valid (i.e. neither has VibrationAttributes.USAGE_CLASS_FEEDBACK nor is VibrationAttributes.USAGE_UNKNOWN); otherwise, true, indicating that the haptic feedback request has been sent to the system. Note that true could be returned but no vibration may be produced if the service decides that the device's states do not allow for this haptic feedback (for example, the user disabled vibrations for this usage).
- Attributes
Remarks
Like performHapticFeedback(int, int), but takes a HapticFeedbackRequest.
Using a HapticFeedbackRequest allows you to make more elaborate haptic feedback requests, including setting the usage type for the requested feedback.
Specifying the usage type for your feedback allows the system to understand the context of the feedback better, and tune the haptic accordingly. When not specifying the usage type for the feedback request, or when using the other performHapticFeedback APIs, the system will do a best guess of the vibration usage based on the constant.
See VibrationAttributes to learn more about vibration usages. The usage provided for this API must be of VibrationAttributes.USAGE_CLASS_FEEDBACK, or VibrationAttributes.USAGE_UNKNOWN. Otherwise, the haptic feedback will not be played. If VibrationAttributes.USAGE_UNKNOWN is used, the system will do a best guess of the vibration usage based on the constant.
Note that, if you will be calling this API repeatedly and your HapticFeedbackRequest does not change across these repeated calls, it is recommended that you create, cache, and reuse the request object to avoid the costs of repeated object creation and garbage collection.
Android reference for android.view.View.performHapticFeedback.
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
PerformHapticFeedback(FeedbackConstants)
BZZZTT!!1!
[Android.Runtime.Register("performHapticFeedback", "(I)Z", "GetPerformHapticFeedback_IHandler")]
public virtual bool PerformHapticFeedback(Android.Views.FeedbackConstants feedbackConstant);
[<Android.Runtime.Register("performHapticFeedback", "(I)Z", "GetPerformHapticFeedback_IHandler")>]
abstract member PerformHapticFeedback : Android.Views.FeedbackConstants -> bool
override this.PerformHapticFeedback : Android.Views.FeedbackConstants -> bool
Parameters
- feedbackConstant
- FeedbackConstants
One of the constants defined in
HapticFeedbackConstants
Returns
The result of the perform haptic feedback operation.
- Attributes
Remarks
BZZZTT!!1!
Provide haptic feedback to the user for this view.
The framework will provide haptic feedback for some built in actions, such as long presses, but you may wish to provide feedback for your own widget.
The feedback will only be performed if #isHapticFeedbackEnabled() is true.
Java documentation for android.view.View.performHapticFeedback(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
PerformHapticFeedback(FeedbackConstants, FeedbackFlags)
BZZZTT!!1!
[Android.Runtime.Register("performHapticFeedback", "(II)Z", "GetPerformHapticFeedback_IIHandler")]
public virtual bool PerformHapticFeedback(Android.Views.FeedbackConstants feedbackConstant, Android.Views.FeedbackFlags flags);
[<Android.Runtime.Register("performHapticFeedback", "(II)Z", "GetPerformHapticFeedback_IIHandler")>]
abstract member PerformHapticFeedback : Android.Views.FeedbackConstants * Android.Views.FeedbackFlags -> bool
override this.PerformHapticFeedback : Android.Views.FeedbackConstants * Android.Views.FeedbackFlags -> bool
Parameters
- feedbackConstant
- FeedbackConstants
One of the constants defined in
HapticFeedbackConstants
- flags
- FeedbackFlags
Additional flags as per HapticFeedbackConstants.
Returns
The result of the perform haptic feedback operation.
- Attributes
Remarks
BZZZTT!!1!
Like #performHapticFeedback(int), with additional options.
Java documentation for android.view.View.performHapticFeedback(int, 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.