USB comms between Tablet and Ubuntu PC Exception
- Android Development
- 1 Replies
I'm still learning about this myself, but to use USB you need to make a permission popup happen and the user has to grant permission. Everything I've read so far says there's no way to skip that. Since you're seeing a SecurityException, my guess is that's what you're running into.
To make this happen, you need to set up the app configuration right, and in your code you have to create an Intent that asks for "com.android.example.USB_PERMISSION", call UsbManager.requestPermission() with it, and have a BroadcastReceiver ready to receive the permission response and use it to set up the USB connection.
See these links:
https://stackoverflow.com/questions/12388914/usb-device-access-pop-up-suppression
https://developer.android.com/guide/topics/connectivity/usb/accessory.html
If you've managed to figure this out since you posted this question, I'd appreciate some advice.
To make this happen, you need to set up the app configuration right, and in your code you have to create an Intent that asks for "com.android.example.USB_PERMISSION", call UsbManager.requestPermission() with it, and have a BroadcastReceiver ready to receive the permission response and use it to set up the USB connection.
See these links:
https://stackoverflow.com/questions/12388914/usb-device-access-pop-up-suppression
https://developer.android.com/guide/topics/connectivity/usb/accessory.html
If you've managed to figure this out since you posted this question, I'd appreciate some advice.
