App crashing when setting the UsbManager and no USB device is connected

ClaudyDetryClaudyDetry ✭✭USMember ✭✭

Hello,

I am developping an application using a USB Smartcard reader.

When no device is connected, the following line makes the app crash.
mManager = (UsbManager)Android.App.Application.Context.GetSystemService(Context.UsbService);

Should I check if a device is connected before?
If yes, how?

Best regards.
Claudy

Tagged:
Sign In or Register to comment.