HEADSET_PLUG delivery method for Android phone ZTE T815

I registered BroadcastReceiver to receive ACTION_HEADSET_PLUG, which works fine for most devices, i.e. It is called whenever the headset is connected or disconnected. But on others, such as the ZTE T815, an intent is never sent / received when the headset is connected / disconnected.

For reference: recipient registration code:

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)); } 

Additional information: The assignment is sent, but only after the HEADSET_HOOK command is run on the headset.

And when the intention is sent

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

always returns 0 (i.e. no microphone).

So,

  • Is there any config / code that might force delivery of this Intention?
  • How do I get the intention to correctly report whether a microphone exists or not?
0
source share
1 answer

It turned out that the ZTE T815 has an OMTP TRRS configuration for its audio jack instead of CTIA / AHJ, like all other modern Android devices.

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

The sad state of affairs, especially when trying to use the audio stream in different products.

0
source

All Articles