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

Handle headset plugged event #30

Closed
lukeweber opened this issue Oct 23, 2012 · 1 comment
Closed

Handle headset plugged event #30

lukeweber opened this issue Oct 23, 2012 · 1 comment

Comments

@lukeweber
Copy link
Owner

From:

https://android.googlesource.com/platform/packages/apps/Phone/+/5bcbca1162b1b462d15ebb4a5b2859a076d382e2/src/com/android/phone/PhoneApp.java

intentFilter.addAction(Intent.ACTION_HEADSET_PLUG);

mIsHeadsetPlugged = (intent.getIntExtra("state", 0) == 1);

if (!isHeadsetPlugged()) {
// if the state is "not connected", restore the speaker state.
PhoneUtils.restoreSpeakerMode(getApplicationContext());
} else {
// if the state is "connected", force the speaker off without
// storing the state.
PhoneUtils.turnOnSpeaker(getApplicationContext(), false, false);
}

@jreyes
Copy link
Contributor

jreyes commented Jan 18, 2013

Fixed on issue 60

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

No branches or pull requests

2 participants