Hear the main button press on bluetoot headset in Android quality?

Is there a way to listen to the main button press from a simple (non-media) Bluetooth headset? I want to use it for push-to-talk inapp actions.

Jabra BT2050 main button

I tried several examples but the event was not fired. Bluetooth Launch app doesn't work. Is this even possible?

Appears in the log when I press the main button

3601-3704/? E/bt-rfcomm﹕ PORT_DataInd, p_port:0xa2c3835c, p_data_co_callback is null
3601-3704/? D/bt-btif﹕ bta_ag_hdl_event: p_scb 0xa2c40abc
3601-3704/? D/bt-btif﹕ AG evt (hdl 0x0001): State 2, Event 0x050b
  866-883/? I/art﹕ Explicit concurrent mark sweep GC freed 144419(6MB) AllocSpace objects, 2(1566KB) LOS objects, 33% free, 26MB/40MB, paused 1.374ms total 143.531ms
3601-3704/? D/bt-btif﹕ bta_ag_rfc_data, change link policy for SCO
3601-3657/? D/bt-btif﹕ btif_hf_upstreams_evt: event=BTA_AG_AT_CKPD_EVT
3601-3678/? D/HeadsetStateMachine﹕ AudioOn process message: 101, size: 1
3601-3678/? D/HeadsetStateMachine﹕ event type: 16
1475-1512/? I/Telecom﹕ BluetoothPhoneService: BT - hanging up call
1475-1475/? D/Telecom﹕ BluetoothPhoneService: handleMessage(2) w/ param 0

      

Appears in the log when I press volume +

3601-3704/? E/bt-rfcomm﹕ PORT_DataInd, p_port:0xa2c3835c, p_data_co_callback is null
3601-3704/? D/bt-btif﹕ bta_ag_hdl_event: p_scb 0xa2c40abc
3601-3704/? D/bt-btif﹕ AG evt (hdl 0x0001): State 2, Event 0x050b
3601-3657/? D/bt-btif﹕ btif_hf_upstreams_evt: event=BTA_AG_SPK_EVT
3601-3678/? D/HeadsetStateMachine﹕ AudioOn process message: 101, size: 1
3601-3678/? D/HeadsetStateMachine﹕ event type: 6
3601-3704/? D/bt-btif﹕ bta_ag_rfc_data, change link policy for SCO
  337-337/? D/compress_voip﹕ voice_extn_compress_voip_out_get_parameters: enter
  337-337/? D/audio_hw_extn﹕ audio_extn_get_parameters: returns
  337-337/? I/str_params﹕ key: 'bt_headset_vgs' value: ''
3601-3678/? D/HeadsetStateMachine﹕ AudioOn process message: 7, size: 1

      

Appears in the log when I press the volume -

3601-3704/? E/bt-rfcomm﹕ PORT_DataInd, p_port:0xa2c3835c, p_data_co_callback is null
3601-3704/? D/bt-btif﹕ bta_ag_hdl_event: p_scb 0xa2c40abc
3601-3704/? D/bt-btif﹕ AG evt (hdl 0x0001): State 2, Event 0x050b
3601-3657/? D/bt-btif﹕ btif_hf_upstreams_evt: event=BTA_AG_SPK_EVT
3601-3678/? D/HeadsetStateMachine﹕ AudioOn process message: 101, size: 1
3601-3678/? D/HeadsetStateMachine﹕ event type: 6
3601-3704/? D/bt-btif﹕ bta_ag_rfc_data, change link policy for SCO
337-1032/? D/compress_voip﹕ voice_extn_compress_voip_out_get_parameters: enter
337-1032/? D/audio_hw_extn﹕ audio_extn_get_parameters: returns
337-1032/? I/str_params﹕ key: 'bt_headset_vgs' value: ''
3601-3678/? D/HeadsetStateMachine﹕ AudioOn process message: 7, size: 1

      

Devices: Sony Tablet Z2 (WIFI only) with Android 5.0.2 and Jabra BT2050 Bluetooth headset.

+3


source to share





All Articles