Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

general setting for haptic feedback on Android

Tags:

android

button

I learned that haptic feedback on a button press on Android has to be programmed individually for each button in each app.

However, is there anywhere a general setting that one can/should access that defines if the user wants haptic feedback at all?

Is there anything like a general setting to know how strong/long it should be?

Or has everything to be defined in the individual app - also posibly a setting that asks for haptic feedback on/off?

Many thanks!

like image 878
user387184 Avatar asked Mar 27 '26 11:03

user387184


1 Answers

Look for View.performHapticFeedback(int feedbackConstant, int flags). You specify the the underlying event (e.g. long press) and qualifier (e.g. ignore view setting, use global setting) and you get a standard vibration which is conditioned on the global Haptic Feedback setting.

It returns true if haptic feedback actually performed.

Check the source code here for more details

http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.0_r1/android/view/View.java#View.performHapticFeedback%28int%2Cint%29

like image 158
user1076637 Avatar answered Mar 29 '26 01:03

user1076637



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!