This repository contains a minimal Android Studio project skeleton (Kotlin) which demonstrates the concept of trying to force audio input routing to the phone's built-in microphone while a headset is plugged in.
IMPORTANT NOTES:
- This project is a proof-of-concept skeleton only. It does NOT guarantee success on any device.
- Many audio routing APIs are restricted or deprecated. Forcing input device often requires either:
- Root access, or
- Shizuku with proper permission grant, or
- Modifying platform audio policy (vendor-specific).
- Building an APK from this project must be done on your machine (Android Studio or command line).
- Use responsibly. Some devices may not allow these hacks. You may need to adapt code for your target device.
- Install Android Studio (Arctic Fox or newer recommended).
- Open this project folder.
- Let Gradle sync and install required SDK (compileSdk 34).
- Build a debug APK via 'Build > Build Bundle(s) / APK(s) > Build APK(s)'. Or use command line: ./gradlew assembleDebug
- Install Shizuku on your device and grant necessary permissions.
- The current Shizuku usage in this skeleton is minimal and for demonstration only.
- Consult Shizuku docs for integrating properly.
- I could not compile an APK here. I packaged the project skeleton so you can build the APK on your machine/device.
- If you want, I can provide a GitHub Actions workflow you can paste into your repo to auto-build an APK on push.