|
@ -0,0 +1,20 @@
|
|
1
|
package com.ai.mobile.simcard;
|
|
2
|
|
|
3
|
import android.content.BroadcastReceiver;
|
|
4
|
import android.content.Context;
|
|
5
|
import android.content.Intent;
|
|
6
|
import android.widget.Toast;
|
|
7
|
|
|
8
|
import com.ai.mobile.IpuApplication;
|
|
9
|
|
|
10
|
public class UsbMonitor extends BroadcastReceiver
|
|
11
|
{
|
|
12
|
public void onReceive(Context paramContext, Intent paramIntent)
|
|
13
|
{
|
|
14
|
if ("android.hardware.usb.action.USB_DEVICE_ATTACHED".equals(paramIntent.getAction())){
|
|
15
|
Toast.makeText(paramContext, "检测到有设备插入", Toast.LENGTH_SHORT).show();
|
|
16
|
}else if ("android.hardware.usb.action.USB_DEVICE_DETACHED".equals(paramIntent.getAction())){
|
|
17
|
Toast.makeText(paramContext, "检测到有设备拔出", Toast.LENGTH_SHORT).show();
|
|
18
|
}
|
|
19
|
}
|
|
20
|
}
|