سؤال

How can I use UsbManager class in Android API level 1? I'll try the code below but I can not reach UsbManager.

IntentFilter deviceAttachedFilter = new IntentFilter();
deviceAttachedFilter.addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED);
deviceAttachedFilter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED);
registerReceiver(mUsbReceiver, deviceAttachedFilter);
هل كانت مفيدة؟

المحلول

As stated in the official Documentation, UsbManager was introduced with API level 12.

There is no way to use it on previous platform versions. It runs as a system service, and those cannot be easily backported.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top