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)) {
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?
William
source share