Android : how to detect already connected usb device?

后端 未结 3 960
庸人自扰
庸人自扰 2020-12-09 23:22

I\'m trying to detect usb devices which are already connected to android. I understand there are actions to detect when USB is either attached or detached. But I don\'t rea

3条回答
  •  春和景丽
    2020-12-09 23:47

    Just to answer Benny's question here is what the mPermissionIntent could look like:

    string actionString = context.PackageName + ".action.USB_PERMISSION";
    
    PendingIntent mPermissionIntent = PendingIntent.GetBroadcast(context, 0, new 
    Intent(actionString), 0);
    mUsbManager.RequestPermission(device, permissionIntent);
    

提交回复
热议问题