Android Question android.intent.action.MEDIA_BUTTON again II

ocalle

Active Member
Licensed User
Longtime User
Hello, have someone got a complete example to check if headphone switch button is pressed?
I very confused with the manifest, tested an erel example but then not work anymore.

Thank you and sorry by be repetitive

Osvaldo
 

ocalle

Active Member
Licensed User
Longtime User
Yes Many ThankS! works fine! but with the activity right button on the phone, i need sense the jack button on headphone connector, similar to microphone function on earphones
 
Upvote 0

ocalle

Active Member
Licensed User
Longtime User
Its intended to use with an old woman that cannot dial the phone, need call her son by a button
 
Upvote 0

ocalle

Active Member
Licensed User
Longtime User
Sometimes works some times no, how can i do this in b4a? Thank You!

@override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_HEADSETHOOK){
//handle click
return true;
}
return super.onKeyDown(keyCode, event);
}
 
Last edited:
Upvote 0

ocalle

Active Member
Licensed User
Longtime User
Thanks Erel, not work to me with keypress, i think is that more a mic state than a Keypress, the routine of change internal mic to external, when u click the headphone make some resistance that is detected by Os and change the mic to external.
 
Upvote 0
Top