Accessorio USB Android.
-
10-12-2019 - |
Domanda
Ho una tabella di aggiornamento da 2,3,3,3 a 4.0.Sta funzionando bene. Ora, ho installato l'applicazione del test ADB dal codice di esempio. Ma non mostra nulla.Solo lo schermo nero è lì quando attivo il mouse o la tastiera USB USB.Mouse e la tastiera funzionanti, ma l'applicazione del test ADB non mostra nulla.
Come posso testare che ci è che l'API accessorio USB è presente nel tablet? Qualcuno può fornire il codice di esempio per quello?
Grazie.
Soluzione
Upgrading the Android device from 2.3.3 to 4.0 may not enough to make sure that it will support accessory mode required by ADK. Check the kernel version of the ROM. If it below 2.6.., then most probably it does not support the accessory mode.
Altri suggerimenti
Try this, taken from http://developer.android.com/guide/topics/usb/accessory.html
UsbAccessory mAccessory;
ParcelFileDescriptor mFileDescriptor;
FileInputStream mInputStream;
FileOutputStream mOutputStream;
...
private void openAccessory() {
Log.d(TAG, "openAccessory: " + accessory);
mFileDescriptor = mUsbManager.openAccessory(mAccessory);
if (mFileDescriptor != null) {
FileDescriptor fd = mFileDescriptor.getFileDescriptor();
mInputStream = new FileInputStream(fd);
mOutputStream = new FileOutputStream(fd);
Thread thread = new Thread(null, this, "AccessoryThread");
thread.start();
}
}