Detecting headset button

Hello,
i’m looking for a way to detect a pressed button of a headset.
Is this possible with the App Inventor?

Many thanks in advance!
Gerhard

Hello Gerhard

Unlikely. What exactly is the button for? Are the headphones plugged in to the Android device or are they using Bluetooth?

Hello Chris,
thanks for the quick repsonse.

I would like to control an app with the help of the headset buttons without using the display.

I would prefer to use a bluetooth headset but a cabled one will be good too.

regards
Gerhard

I could be completely wrong but I think that is beyond App Inventor’s capability, unless the headphones were specially designed to communicate with an App other than the headphone manufacturer’s App.

Using a Bluetooth Media Button would also be fine, but no idea if this devices would work.

regards
Gerhard

https://puravidaapps.com/headset.php

Close, but no cigar.

1 Like

App Inventor Extensions: Headset Plug Status | Pura Vida Apps

I'm aware of this extension but unfortunatley this extension only detects the status of the headset.

regards
Gerhard

a few weeks ago I already looked into adding this feature into my Headset Plug Status Extension

however this seems to be more complex than it looks like... also different Android versions will work differently...

I tried

but both unfortunately did not work on my Android 8 device.

There also is this solution bluetooth - Android "O" (Oreo, 8) and higher media buttons issue - Stack Overflow and probably one day when I'm more motivated I will take some time to try that...

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Hello Taifun,
many thanks for your answer and explanation.

So I hope that you’ll be motivated to try this solution :grinning:
Is there any way to increase your motivation :smirk:?

regards
Gerhard

I looked at this today again and I now think, it is not possible to detect a headset button click as extension.

The solution mentioned in Stackoverflow requires a service, to receive a key event.
https://developer.android.com/reference/android/support/v4-media-session/MediaButtonReceiver
And as far as I know, this is not possible as extension.

What I can offer is to detect a volume change, so if you press the volume up or down button on the headset, an event could be triggered.

Taifun

1 Like

Hello Taifun,
volume up/down button would be fine too. I would only need 2 buttons.

regards
Gerhard

Please Made This Extension Updated with
Add Future of Headset Button Pressed Event...
I Will Pay You Some Donation...

Give Me Your Pay Pal Link....

also i am redy to buy this Extension....

if Possible do ASAP😂

Any chance of such an extension?
So I've been waiting two years for it and there is nothing working

Guys, be patient! Taifun has to maintain a full website of tutorials, extensions and snippets. A single person maintaining this is already difficult. People also have lives outside of builders (i.e. deal with real life stuff). :slight_smile:

I already explained earlier, why I did not implement this...

Btw. the extension is open source... everyone is invited to add the functionality, just give it a try yourself...

Taifun

If you read the thread, you'd've seen that this is impossible, at the present moment. Also, please stop promoting random [and potentially malicious] websites.

2 Likes