Way to ensure delivery of Action HEADSET_PLUG for ZTE T815 Android phone
Asked Answered
S

1

0

I have registered a BroadcastReceiver to receive ACTION_HEADSET_PLUG which works fine for most devices, ie it is called whenever the headset is plugged or unplugged. But on others eg the ZTE T815, the Intent is never sent/received when the headset is plugged/unplugged.

For reference here is the code for the receiver registration:

private final BroadcastReceiver headsetPlugReceiver = new BroadcastReceiver() {

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.d(TAG, "Received intent=" + intent);
        if (intent.getAction().equalsIgnoreCase(Intent.ACTION_HEADSET_PLUG)) {
            // do stuff
        }
    }
};

public void onCreate(Bundle savedState) {
    super.onCeate(savedState);
    // ...
    registerReceiver(headsetPlugReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG));
}

Further info: The Intent is dispatched but only after the HEADSET_HOOK command is fired on the headset.

And when the Intent is dispatched

final int microphone = intent.getIntExtra("microphone", 0);

always returns 0 (ie no microphone).

So

  1. Is there some config/code that can force the delivery of this Intent?
  2. How do I get the Intent to correctly report whether a microphone exists or not?
Shearwater answered 20/2, 2015 at 0:19 Comment(2)
Are you sure its device dependent or is it microphone dependent?Bayberry
Device dependent. Several microphones work fine on several dozen other devices. No microphones work on this device.Shearwater
S
0

It turns out the ZTE T815 has an OMTP TRRS config for its audio socket instead of CTIA/AHJ like every other modern Android device.

See http://en.wikipedia.org/wiki/Phone_connector_%28audio%29

A sad state of affairs, especially when trying to use audio feed inpout across products.

Shearwater answered 5/3, 2015 at 0:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.