Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable speakerphone when headphones are plugged #1097

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

theAkito
Copy link
Collaborator

This is the very reduced result of my efforts to get this working.

I was sure, you didn't want dead code spread all over the place, so I reduced it to a minimum, only keeping HeadsetPlugReceiver, since it's, by the book, fully functioning and correct, yet it yielded no expected results.

If you still want to remove it, it would be nice to first save it somewhere via Git, so this ready piece of equipment can be used at a later point in time, without having to research from scratch.

The way this is problem is solved now is that the speakerphone is disabled, when a headset or headphones are already physically plugged into the device, when a call is started.

I have found no way of continuously receiving a message regarding, whether such a device is plugged in or out. All the possibilities seem to be a one-off check, without possibility of receiving it continuously.

That said, I'm done with this issue, because there doesn't seem to be a good way of completely or at least sufficiently controlling the headphones plugging process.

If you want to try your luck, knock yourself out, though I would suggest not to invest too many resources into this. It's not worth it.

Resolves #886.

@theAkito theAkito force-pushed the #886.audio.switch-audio-output branch from e67dfb3 to 564ae68 Compare November 18, 2022 02:16
@theAkito theAkito force-pushed the #886.audio.switch-audio-output branch from 564ae68 to 3214bc8 Compare November 18, 2022 02:24
@robinlinden
Copy link
Collaborator

Thank you! Looks neat and I'll have a look and see if I can get it working properly. :)
In general, I think you have to add BroadcastReceivers in the AndroidManifest.xml. Is that part of what you removed while reducing the code, or is that something we still need to try?

@theAkito
Copy link
Collaborator Author

In general, I think you have to add BroadcastReceivers in the AndroidManifest.xml. Is that part of what you removed while reducing the code, or is that something we still need to try?

Usually you need to add broadcast receivers to the manifest, but in this case you should not. It does not break anything, but it does not do anything and certainly does not help. When dealing with this Audio stuff, one has to do it in the code, only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatically switch to headphones when plugged in during call
2 participants