问题
I have a dev board running Android 4.0.4 and am using it as a USB accessory. When I close the application on the board then plug in an Android phone over USB the board prompts "Open AppName when this USB device is connected?". When I touch OK, the application launches and the popup is shown again, and it's also shown on the phone this time (but says accessory instead of device).
I am also noticing that when I plug in the device I receive the action android.hardware.usb.action.USB_DEVICE_DETACHED
before I receive android.hardware.usb.action.USB_DEVICE_ATTACHED
, which seems like very strange behavior.
I can provide more details but I'm not entirely sure what would be helpful for debugging. My question: What is causing this behavior?
来源:https://stackoverflow.com/questions/20790383/android-asks-for-usb-permission-twice