diff --git a/media/java/android/media/midi/package.html b/media/java/android/media/midi/package.html index a6753913bf3e2..7baa5bc42bd2c 100644 --- a/media/java/android/media/midi/package.html +++ b/media/java/android/media/midi/package.html @@ -31,7 +31,7 @@ capabilities, etc.
  • Timestamps to avoid jitter.
  • Support creation of virtual MIDI devices that can be connected to other devices. An example might be a synthesizer app that can be controlled by a composing app.
  • -
  • Support direction connection or “patching” of devices for lower latency.
  • +
  • Support direct connection or “patching” of devices for lower latency.
  • Transports Supported

    @@ -350,5 +350,54 @@ public class MidiSynthDeviceService extends MidiDeviceService { } } + +

    Using MIDI Over Bluetooth LE

    + +

    MIDI devices can be connected to Android using Bluetooth LE.

    + +

    Before using the device, the app must scan for available BTLE devices and then allow +the user to connect. An example program +will be provided so look for it on the Android developer website.

    + +

    Request Location Permission for BTLE

    + +

    Applications that scan for Bluetooth devices must request permission in the +manifest file. This LOCATION permission is required because it may be possible to +guess the location of an Android device by seeing which BTLE devices are nearby.

    + +
    +<uses-permission android:name="android.permission.BLUETOOTH"/>
    +<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
    +<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    +
    + +

    Apps must also request location permission from the user at run-time. +See the documentation for Activity.requestPermissions() for details and an example. +

    + +

    Scan for MIDI Devices

    + +

    The app will only want to see MIDI devices and not mice or other non-MIDI devices. +So construct a ScanFilter using the UUID for standard MIDI over BTLE.

    + +
    +MIDI over BTLE UUID = "03B80E5A-EDE8-4B33-A751-6CE34EC4C700"
    +
    + +

    Open a MIDI Bluetooth Device

    + +

    See the documentation for android.bluetooth.le.BluetoothLeScanner.startScan() +method for details. When the user selects a MIDI/BTLE device then you can open it +using the MidiManager.

    + +
    +m.openBluetoothDevice(bluetoothDevice, callback, handler);
    +
    + +

    Once the MIDI/BTLE device has been opened by one app then it will also become available to other +apps using the +MIDI device discovery calls described above. +

    +