插入时在 android 中检测卡 reader(信用卡或借记卡)

Detect card reader (Credit or Debit) in android when plugged

这就是我检测耳机是否已连接或断开连接的方式。但我需要找到当一个功劳

"Card reader" is connected to an android device. Because that also will use the same port as headset is plugged. so how to differentiate either connected device is a "card reader" or "headset". I have searched for that to find it specifically. But din't get any solution to find the "Card Reader" is plugged In/Out.

private static final String TAG = "plugstatus";
private PlugListener myReceiver;

@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myReceiver = new PlugListener();
}
@Override public void onResume() {
IntentFilter filter = new IntentFilter(Intent.ACTION_HEADSET_PLUG);
registerReceiver(myReceiver, filter);
super.onResume();
}
private class PlugListener extends BroadcastReceiver {
@Override public void onReceive(Context context, Intent intent) {
    if (intent.getAction().equals(Intent.ACTION_HEADSET_PLUG)) {
        int state = intent.getIntExtra("state", -1);
        switch (state) {
        case 0:
            Log.d(TAG, "Headset unplugged");
            break;
        case 1:
            Log.d(TAG, "Headset plugged");
            break;
        default:
            Log.d(TAG, "Not able to detect plug state");
        }
    }
  }
}

@Override public void onPause() {
   unregisterReceiver(myReceiver);
   super.onPause();
}

基本上我们无法检测具体是耳机还是卡reader。