USB 호스트를 망쳐 놓고 지침을 따르면 on the Android Developers 사이트 특정 USB 장치를 연결하면 시작되는 Hello World를 만들 수있었습니다. "의도에서 연결된 장치를 나타내는 UsbDevice를 얻기 ..."시도는 null를 돌려 :Android : 인 텐트에서 UsbDevice 받기
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" />
</activity>
</application>
그리고 내 XML/device_filter.xml (내가 아는 : 여기
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = new Intent();
UsbDevice device = (UsbDevice) intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
// device is always null
if (device == null){Log.i(TAG,"Null device");}
내 매니페스트의 비슷한 응용 프로그램을 가지고 있기 때문에 이것들은 올바른 VID와 PID입니다. 열거 방법)
on the Android Developers 사이트를 설명 노래 :
<resources>
<usb-device vendor-id="1234" product-id="1234"/>
</resources>
나는 USB 호스트 통신을 개발하고 있는데, 어딘가에서 코드를 찾을 수 있습니까? – usman