How To Detect A Command AT Bluetooth

haesca29

Member
Licensed User
Longtime User
A greeting to all

as I can detect a command sent by a Bluetooth, I need help

Headset Button Press => AT+CKPD=200 =>Command issued by HS to indicate that the button has been pressed.


TK

De Antemano Gracias
 

haesca29

Member
Licensed User
Longtime User
Hello Erel

I try, in this way

B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
   If KeyCode=KeyCodes.KEYCODE_HEADSETHOOK Then
      Label1.Color = Colors.Red
         
   End If

   
   Label1.Text = KeyCode
   
End Sub

KeyCodes.KEYCODE_HEADSETHOOK => works with handsfree cable::)

KeyCodes.KEYCODE_HEADSETHOOK => No works with handsfree Bluetooth :(

Label1.Text = KeyCode => not generate code by pressing button Bluetooth Handsfree

Erel I thank you for the help you can give me
 
Upvote 0

haesca29

Member
Licensed User
Longtime User
Hello Erel

I did this, but it only works with handsfree cable

Manifest Editor

B4X:
)
AddReceiverText(S1,<intent-filter android:priority="2147483647">
<action android:name="android.intent.action.MEDIA_BUTTON"/>
</intent-filter>
)

Service Module

B4X:
Sub Service_Start(StartingIntent As Intent)
'
   If StartingIntent.Action = "android.intent.action.MEDIA_BUTTON" Then
      Log("se oprimio boton del manos libres")
   End If

End Sub

what I have researched, is that when you press the handsfree button it sends an AT command

AT+CKPD=200 =>Command issued by HS to indicate that the button has been pressed.


Help Me
 
Upvote 0
Top