P
P
Pavel K2016-02-29 19:05:47
Android
Pavel K, 2016-02-29 19:05:47

Why doesn't ACTION_USB_DEVICE_ATTACHED work?

Greetings!
I'm trying to use usb host, I
learned how to work with already connected devices, now I want to catch the moment of connecting and disconnecting the device.

IntentFilter usbFilter = new IntentFilter();
usbFilter.addAction(ACTION_USB_PERMISSION);
usbFilter.addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED);
usbFilter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED);
registerReceiver(USBReceiver, usbFilter);

In the manifest
<uses-feature android:name="android.hardware.usb.host"/>
there is.
The ACTION_USB_DEVICE_DETACHED event fires, but ACTION_USB_DEVICE_ATTACHED does not.
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel K, 2016-02-29
@PavelK

And from the manifest, the same event does not work....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question