Android ignore global haptic feedback settings in API 33+

122 views Asked by At

I want to use haptic feedback when the player takes damage or crashes their car in a game and want to ignore the system global haptic feedback setting, which is generally disabled because the user just doesn't want haptics on navigational buttons.. and instead want to have an ingame option to disable damage haptics.

However as of API 33 FLAG_IGNORE_GLOBAL_SETTING for View.performHapticFeedback(int, int) has been made deprecated. The documentation states that only privileged apps can ignore user settings for touch feedback, but what does this mean? Can I request a permission to allow haptics which ignore the global setting or can only system apps ignore the global setting?

Also the reason I want to use haptics rather than vibration if possible is because as stated on the haptic feedback developer page I want the short weak haptic vibration which performHapticFeedback gives (and it's nice to not need the full vibration permission atleast below API 33)

Caution: We strongly discourage using older Vibrator methods employing createOneshot or createWaveform, even if they appear to be supported on the device. These modes are often too loud for regular haptic feedback; use them only as a fallback if you need to highlight an extremely important action.

If it's just no longer possible for me to force haptics on API 33+ is there at-least some way I can check if the device global haptic setting is disabled to fallback to using vibration instead?

0

There are 0 answers