🛠 Limites d'AOA sur Android moderne et alternatives
Objectives
Provide an honest overview of what breaks (or doesn't) in 2026 with the Mega ADK and the AOA protocol, and choose the right alternative based on your project. Sourced findings: the board is retired (official page under docs.arduino.cc/retired, store returns 404); Google ADK documentation has been removed and redirects to the generic "accessories" page; the historical ADK wiki is a 404 with no archive; AOAv2 deprecated USB audio in Android 8.0; AOA and MTP cannot function simultaneously; accessory applications must properly handle USB permissions and device-detached events, and some very recent phones have finicky USB stacks (forum threads about ADK boards that enumerate but fail to open). The AOA protocol itself remains documented (source.android.com) and accessory mode has been available since Android 3.1, backported to 2.3.4: on the Android API side, nothing has disappeared.
Hardware
- 1 × Arduino Mega ADK + recent Android phone for friction tests
- For alternatives: choose from — ESP32-S2/S3 board (native USB OTG), serial Bluetooth module (HC-05 for classic, or BLE), USB-OTG serial adapter (FTDI/CP210x/CH34x) + OTG cable to the phone
- No new hardware required: this tutorial is a decision matrix + a robust Android template
Full Code
Java template for robust handling of an AOA accessory on modern Android (permissions, disconnection, reconnection):
// AccessoireBridge.java — le minimum vital sur Android récent
public class AccessoireBridge {
private UsbManager mgr; private UsbAccessory acc;
private FileInputStream in; private FileOutputStream out;
public boolean attacher(Intent intent) {
String a = intent.getAction;
if (UsbManager.ACTION_USB_ACCESSORY_ATTACHED.equals(a)) {
acc = UsbManager.getAccessory(intent);
if (!mgr.hasPermission(acc)) {
mgr.requestPermission(acc, PendingIntent.getBroadcast(ctx, 0,
new Intent("com.atelier.adk.PERM"), 0));
return false; // reprise après la popup
}
ParcelFileDescriptor pfd = acc.open(mgr, true);
if (pfd == null) return false; // le téléphone refuse parfois
in = new FileInputStream(pfd.getFileDescriptor);
out = new FileOutputStream(pfd.getFileDescriptor);
return true;
}
if (UsbManager.ACTION_USB_ACCESSORY_DETACHED.equals(a)) { detacher; }
return false;
}
public void detacher {
try { if (in != null) in.close; } catch (IOException ignored) { }
try { if (out != null) out.close; } catch (IOException ignored) { }
in = null; out = null; acc = null; // l'UI passe « hors ligne »
}
// Côté manifeste : intent-filter ACCESSORY_ATTACHED + accessory_filter
// (accessory-manufacturer) ; ne JAMAIS envoyer de trame sans out != null.
}
Expected Verification
With the Mega ADK: the phone correctly enumerates with VID 0x18D1, but opening the stream may fail on some recent models — the template above should then display "offline" without crashing, and reconnect upon replugging. If the phone switches to MTP (default file transfer mode for many manufacturers), AOA does not start: you must replug in charge-only mode. Conclusion from the matrix: for a new project, AOA on this retired board is no longer a default choice; keep it for HID host and legacy preservation, and switch to the alternatives below for the phone link.
Common Errors
- Believing that AOA is "dead on Android": the UsbAccessory API still works; it is the ADK ecosystem (2011 package, wiki, docs) that has disappeared, and phone USB stacks that are variable.
- Forgetting to handle ACCESSORY_DETACHED and IOExceptions: on recent Android, the cable is "electrically" disconnected by the system (MTP switching, power saving) without warning the application.
- Using AOAv2 USB audio: deprecated since Android 8.0 — do not build a project on this.
- Missing version string in the accessory descriptor: possible restarts of Android phones ≤ 10 upon enumeration.
- Poorly chosen alternatives: the USB-OTG serial adapter (FTDI/CP210x) assumes the phone is the host — the opposite of the AOA model — and requires the usb-serial-for-android driver; the ESP32-S2/S3 offers native USB AND Bluetooth/BLE, and serial Bluetooth or BLE is almost always simpler than AOA in 2026; BLE is the path without cables or USB permissions.
- Comparing data rates: AOA 1.0 remains a full-speed USB link — more than sufficient for sensors and commands; if your project requires video or audio streaming, switch hardware families.
Other tutorials for this board
Code examples for this board
clignotante.inoArduinobouton-led.inoArduinoscan-hote-usb.inoArduinoadk-chat-android.inoArduinoadk-telemetrie.inoArduinohote-clavier-usb.inoArduino