Following is the scenario:
- Headphones with mic are connected to a mobile device.
What i want to achieve programmatically:
- After a call is been initiated, audio from 3.5mm jack should (forcefully) be routed to mobile earpiece rather then headphone speakers, while the mic should be used of the headphones.
I have searched a lot on google but found methods only to forcefully turn on mobile external speakers. Reference : how to turn speaker on/off programmatically in android 4.0
While, my goal is to turn on earpiece forcefully.
My research from google:
- To achieve this there might be possibilities of system (root) permissions, which a third party application might need.
- You may have to write a modified audio driver from sources ? As the functionality is based on the operating system.
If it is possible, can any one guide me on this ?
UPDATE
One more reference: Android - Getting audio to play through earpiece
But the above code does not work on all phones.