Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
To Top Created with Sketch. To Top
To Bottom Created with Sketch. To Bottom
Android Guides
Using AOA Protocol

Using Android Open Accessory Protocol

Incorporating AOA into an SDL enabled app allows it to create and register an SDL session over USB. This guide will assume the app has already integrated the SDL library as laid out in the previous guides. AOA connections are sent through the SDLRouterService to bypass an Android limitation of only one app being able to be used through the AOA intent.


We will add or make changes to:

  • Android Manifest (of your app)
  • SdlService (optional)


The Installation, SDK Configuration, and Integration Basics guides must be completed before enabling the use of the AOA USB transport. The remainder of the guide will assume all steps will be followed.

Android Manifest

To use the AOA protocol, you must specify so in your app's Manifest with:

<uses-feature android:name="android.hardware.usb.accessory"/>

This feature will not work without including this line!

The SDL Android library houses a USBAccessoryAttachmentActivity that you need to add between your Manifest's <application>…</application> tags:

<activity android:name="com.smartdevicelink.transport.USBAccessoryAttachmentActivity"
        <action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />

        android:resource="@xml/accessory_filter" />

Android API 31 now requires any activity with an intent filter to explicitly set the exported flag to true (exported=true).


The accessory_filter.xml file is included with the SDL Android Library

Media Apps

Media applications do not register over AOA since by default there are no audio streaming methods available.
To get media applications to register, when creating the connection you need to set flag requiresAudioSupport to false:

MultiplexTransportConfig multiplexTransportConfig = new MultiplexTransportConfig(getBaseContext(), APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);

As long as the app doesn't require high bandwidth, it shouldn't matter which transport is being connected. A multiplex transport should be used like the one that follows:

    public int onStartCommand(Intent intent, int flags, int startId) {

        if (sdlManager == null) {
            MultiplexTransportConfig transport = new MultiplexTransportConfig(this, APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);

            SdlManagerListener listener = new SdlManagerListener() {

            // ...

            sdlManager = builder.build();

Using only USB / AOA

The new MultiplexingConfig allows for apps to be able to connect via Bluetooth and USB as primary transports. If you want your app to only use USB / AOA, then you should specifically only set that as the only allowed primary transport.

When defining your transport, also pass in a custom list that only contains the USB:

List<TransportType> multiplexPrimaryTransports = Arrays.asList(TransportType.USB);

MultiplexTransportConfig transport = new MultiplexTransportConfig(this, appId, MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED);


Multiple Transports

Since the SdlRouterService now handles both bluetooth and AOA/USB connections, an app will be connected to the transport that connects first if the app includes it in their transport config. If a module supports secondary transports, the second transport to be connected of bluetooth or USB will be available as well as potentially TCP. This means even though the app might register over bluetooth, if USB or TCP are available those transports will be available for high bandwidth services. For more information please see the Multiple Transport Guide.

View on GitHub.com
Previous Section Next Section