Keycode Constants

Djembefola

Active Member
Licensed User
Longtime User
Some Keycode Constants are missing.
For example:

Keycodes.KEYCODE_MEDIA_PLAY (126)
Keycodes.KEYCODE_MEDIA_PAUSE (127)

B4X:
Compiling code.                         Error
Error compiling program.
Error description: Unknown member: keycode_media_play
 

Djembefola

Active Member
Licensed User
Longtime User
The correct constant is KeyCodes.KEYCODE_MEDIA_PLAY_PAUSE

It seems to depend on the Bluetooth Audio Driver, which Constant is used.

On my HTC Keycodes.KEYCODE_MEDIA_PLAY_PAUSE works fine, but

on newer devices (ACER A500 and Galaxy S2)

Keycodes.KEYCODE_MEDIA_PLAY and
Keycodes.KEYCODE_MEDIA_PAUSE

are sent in the Activity_Keypress Event instead of

Keycode.KEYCODE_MEDIA_PLAY_PAUSE

from Bluetooth Audio.

All three Constants are listed in the Android Documentation.
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…