I have my own BroadcastReceiver
instance for Intent.ACTION_HEADSET_PLUG
action. There is about 1-2 seconds delay between actual physical unplugging a headset and a moment when my BroadcastReceiver
is notified about that.
IntentFilter filter = new IntentFilter(Intent.ACTION_HEADSET_PLUG);
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY - 1);
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// my code here
}
}, filter);
Any ideas how to decrease the delay?