Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
.setResultCallback(new ResultCallback<HeadphoneStateResult>() {
public void onResult(@NonNull HeadphoneStateResult headphoneStateResult) {
if (headphoneStateResult.getStatus().isSuccess()) {
HeadphoneState headphoneState =
int state = headphoneState.getState();
if (state == HeadphoneState.PLUGGED_IN) {
// Headphones plugged in
} else if (state == HeadphoneState.UNPLUGGED) {
// Headphones unplugged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.