Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>OK, I got this updated to support Honeycomb and up. You need to add new functions to the interface. I did that here:</p> <pre><code>interface IBluetoothA2dp { boolean connectSink(in BluetoothDevice device); // Pre API 11 only boolean disconnectSink(in BluetoothDevice device); // Pre API 11 only boolean connect(in BluetoothDevice device); // API 11 and up only boolean disconnect(in BluetoothDevice device); // API 11 and up only boolean suspendSink(in BluetoothDevice device); // all boolean resumeSink(in BluetoothDevice device); // all BluetoothDevice[] getConnectedSinks(); // change to Set&lt;&gt; once AIDL supports, pre API 11 only BluetoothDevice[] getNonDisconnectedSinks(); // change to Set&lt;&gt; once AIDL supports, int getSinkState(in BluetoothDevice device); boolean setSinkPriority(in BluetoothDevice device, int priority); // Pre API 11 only boolean setPriority(in BluetoothDevice device, int priority); // API 11 and up only int getPriority(in BluetoothDevice device); // API 11 and up only int getSinkPriority(in BluetoothDevice device); // Pre API 11 only boolean isA2dpPlaying(in BluetoothDevice device); // API 11 and up only </code></pre> <p>}</p> <p>Then you need to check the API version before calling functions in this interface. Here is my example:</p> <pre><code> if (android.os.Build.VERSION.SDK_INT &lt; 11) { IBluetoothA2dp ibta = getIBluetoothA2dp(); try { Log.d(LOG_TAG, "Here: " + ibta.getSinkPriority(device)); if (ibta != null) ibta.connectSink(device); } catch (Exception e) { Log.e(LOG_TAG, "Error " + e.getMessage()); } } else { IBluetoothA2dp ibta = getIBluetoothA2dp(); try { Log.d(LOG_TAG, "Here: " + ibta.getPriority(device)); if (ibta != null) ibta.connect(device); } catch (Exception e) { Log.e(LOG_TAG, "Error " + e.getMessage()); } } </code></pre> <p>Hope this helps. I was able to get the same app to work with both interfaces.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload