android - USB host has confusing documentation -
i working android host mode usb. in documentation host mode api, manifest requirements suggest using:
android.hardware.usb.action.usb_device_attached
this causing me confusion usbmanager docs suggest using:
android.hardware.usb.action.action_usb_device_attached
can explain difference between two?
furthermore, usbmanager (2nd) version not inform app when device attached, host (1st) version does.
i cannot detached intent work using either version:
android.hardware.usb.action.usb_device_detached android.hardware.usb.action.action_usb_device_detached
please advise.
edit
here manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="cs.android.terminal" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="12" android:targetsdkversion="15" /> <uses-feature android:name="android.hardware.usb.accessory" /> <uses-feature android:name="android.hardware.usb.host" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".mainactivity" android:label="@string/title_activity_main" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> <action android:name="android.hardware.usb.action.usb_device_attached" /> <category android:name="android.intent.category.default" /> </intent-filter> <meta-data android:name="android.hardware.usb.action.usb_device_attached" android:resource="@xml/device_filter" /> </activity> <receiver android:name="cs.android.terminal.terminalreceiver" android:exported="false" > <intent-filter> <action android:name="android.hardware.usb.action.usb_device_detached" /> <category android:name="android.intent.category.default" /> </intent-filter> </receiver> </application> </manifest>
usb_device_attached
used in manifest file detect when device attached usb. action_usb_device_attached
used in java code indicate action performed , action is. although there error/bug action_usb_device_attached
android not detect broadcastreceiver within java code, can detected within manifest currently. said, use usb_device_attached
in manifest.
edit: try this:
<meta-data android:name="android.hardware.usb.action.usb_device_detached" android:resource="@xml/device_filter" />
Comments
Post a Comment