I'm implementing a virtual Android keyboard and are about to add haptic feedback. Luckily Android provides performHapticFeedback()
and HapticFeedbackConstants
so it's easy to give the user a haptic feedback.
It's however not clear to me what the difference between KEYBOARD_PRESS
and VIRTUAL_KEY
is, they both seem to represent pressing a virtual key. This is also the case for their counterparts KEYBOARD_RELEASE
and VIRTUAL_KEY_RELEASE
which both seems to represent the user release a virtual key.
I found the commit where the newest ones were added (in API 27) but that unfortunally didn't clarify anything. The documentation states the following:
KEYBOARD_PRESS
(Constant Value: 3 (0x00000003))The user has pressed a virtual or software keyboard key.
VIRTUAL_KEY
(Constant Value: 1 (0x00000001))The user has pressed on a virtual on-screen key.
KEYBOARD_TAP
maybe also makes sense to mention, but it has the same value KEYBOARD_PRESS
so I think it's more obvious that they represent the same thing. For completeness it's documentation is:
KEYBOARD_TAP
(Constant Value: 3 (0x00000003))The user has pressed a soft keyboard key.
User contributions licensed under CC BY-SA 3.0