Added in API level 35

MidiUmpDeviceService


abstract class MidiUmpDeviceService : Service
kotlin.Any
   ↳ android.content.Context
   ↳ android.content.ContextWrapper
   ↳ android.app.Service
   ↳ android.media.midi.MidiUmpDeviceService

A service that implements a virtual MIDI device for Universal MIDI Packets (UMP). Subclasses must implement the onGetInputPortReceivers method to provide a list of MidiReceivers to receive data sent to the device's input ports. Similarly, subclasses can call getOutputPortReceivers to fetch a list of MidiReceivers for sending data out the output ports. Unlike traditional MIDI byte streams, only complete UMPs should be sent. Unlike with MidiDeviceService, the number of input and output ports must be equal.

To extend this class, you must declare the service in your manifest file with an intent filter with the SERVICE_INTERFACE action and meta-data to describe the virtual device. For example:

<service android:name=".VirtualDeviceService"
          android:label="@string/service_name">
      <intent-filter>
              <action android:name="android.media.midi.MidiUmpDeviceService" />
      </intent-filter>
      <property android:name="android.media.midi.MidiUmpDeviceService"
              android:resource="@xml/device_info" />
  </service>

Summary

Constants
static String

Inherited constants
Public constructors

Public methods
MidiDeviceInfo?

Returns the MidiDeviceInfo instance for this service

MutableList<MidiReceiver!>

Returns a list of MidiReceiver for the device's output ports.

open IBinder?
onBind(intent: Intent)

Return the communication channel to the service.

open Unit

Called to notify when the virtual MIDI device running in this service has been closed by all its clients

open Unit

open Unit

Called to notify when the MidiDeviceStatus has changed

abstract MutableList<MidiReceiver!>

Returns a list of MidiReceiver for the device's input ports.

Inherited functions

Constants

SERVICE_INTERFACE

Added in API level 35
static val SERVICE_INTERFACE: String
Value: "android.media.midi.MidiUmpDeviceService"

Public constructors

MidiUmpDeviceService

MidiUmpDeviceService()

Public methods

getDeviceInfo

Added in API level 35
fun getDeviceInfo(): MidiDeviceInfo?

Returns the MidiDeviceInfo instance for this service

Return
MidiDeviceInfo? the MidiDeviceInfo of the virtual MIDI device if it was successfully created This value may be null.

getOutputPortReceivers

Added in API level 35
fun getOutputPortReceivers(): MutableList<MidiReceiver!>

Returns a list of MidiReceiver for the device's output ports. These can be used to send data out the device's output ports. The number of input and output ports must be equal and non-zero.

Return
MutableList<MidiReceiver!> the list of MidiReceivers This value cannot be null.

onBind

Added in API level 35
open fun onBind(intent: Intent): IBinder?

Return the communication channel to the service. May return null if clients can not bind to the service. The returned android.os.IBinder is usually for a complex interface that has been described using aidl.

Note that unlike other application components, calls on to the IBinder interface returned here may not happen on the main thread of the process. More information about the main thread can be found in Processes and Threads.

Parameters
intent Intent: This value cannot be null.
Return
IBinder? This value may be null.

onClose

Added in API level 35
open fun onClose(): Unit

Called to notify when the virtual MIDI device running in this service has been closed by all its clients

onCreate

Added in API level 35
open fun onCreate(): Unit

onDeviceStatusChanged

Added in API level 35
open fun onDeviceStatusChanged(status: MidiDeviceStatus): Unit

Called to notify when the MidiDeviceStatus has changed

Parameters
status MidiDeviceStatus: the current status of the MIDI device This value cannot be null.

onGetInputPortReceivers

Added in API level 35
abstract fun onGetInputPortReceivers(): MutableList<MidiReceiver!>

Returns a list of MidiReceiver for the device's input ports. Subclasses must override this to provide the receivers which will receive data sent to the device's input ports. The number of input and output ports must be equal and non-zero.

Return
MutableList<MidiReceiver!> list of MidiReceivers This value cannot be null.