-
-
Save Volcanoscar/5303356f2136d4eabd93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE); | |
try { | |
// setWiredDeviceConnectionState(int device, int state, String name); | |
Method method = AudioManager.class.getMethod("setWiredDeviceConnectionState", int.class, int.class, String.class); | |
method.invoke(audioManager, 4, 0, "headset"); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment