コンテンツに移動

よくアクセスするページ

最近アクセスしたページ

navigation

MidiDeviceService

public abstract class MidiDeviceService
extends Service

java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ android.media.midi.MidiDeviceService


A service that implements a virtual MIDI device. 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.

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.MidiDeviceService" />
     </intent-filter>
           <meta-data android:name="android.media.midi.MidiDeviceService"
                android:resource="@xml/device_info" />
 </service>

Summary

Constants

String SERVICE_INTERFACE

Inherited constants

Public constructors

MidiDeviceService()

Public methods

final MidiDeviceInfo getDeviceInfo()

returns the MidiDeviceInfo instance for this service

final MidiReceiver[] getOutputPortReceivers()

Returns an array of MidiReceiver for the device's output ports.

IBinder onBind(Intent intent)

Return the communication channel to the service.

void onClose()

Called to notify when our device has been closed by all its clients

void onCreate()

Called by the system when the service is first created.

void onDeviceStatusChanged(MidiDeviceStatus status)

Called to notify when an our MidiDeviceStatus has changed

abstract MidiReceiver[] onGetInputPortReceivers()

Returns an array of MidiReceiver for the device's input ports.

Inherited methods

Constants

SERVICE_INTERFACE

added in API level 23
String SERVICE_INTERFACE

Constant Value: "android.media.midi.MidiDeviceService"

Public constructors

MidiDeviceService

added in API level 23
MidiDeviceService ()

Public methods

getDeviceInfo

added in API level 23
MidiDeviceInfo getDeviceInfo ()

returns the MidiDeviceInfo instance for this service

Returns
MidiDeviceInfo our MidiDeviceInfo

getOutputPortReceivers

added in API level 23
MidiReceiver[] getOutputPortReceivers ()

Returns an array of MidiReceiver for the device's output ports. These can be used to send data out the device's output ports.

Returns
MidiReceiver[] array of MidiReceivers

onBind

added in API level 23
IBinder onBind (Intent intent)

Return the communication channel to the service. May return null if clients can not bind to the service. The returned 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: The Intent that was used to bind to this service, as given to Context.bindService. Note that any extras that were included with the Intent at that point will not be seen here.

Returns
IBinder Return an IBinder through which clients can call on to the service.

onClose

added in API level 23
void onClose ()

Called to notify when our device has been closed by all its clients

onCreate

added in API level 23
void onCreate ()

Called by the system when the service is first created. Do not call this method directly.

onDeviceStatusChanged

added in API level 23
void onDeviceStatusChanged (MidiDeviceStatus status)

Called to notify when an our MidiDeviceStatus has changed

Parameters
status MidiDeviceStatus: the number of the port that was opened

onGetInputPortReceivers

added in API level 23
MidiReceiver[] onGetInputPortReceivers ()

Returns an array 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. An empty array should be returned if the device has no input ports.

Returns
MidiReceiver[] array of MidiReceivers

このサイトでは、ユーザーが選択したサイトの言語と表示設定を保存する目的で Cookie を使用しています。

Android デベロッパー向けの最新情報やヒントを入手して、Google Play での成功を手に入れましょう。

* 必須

送信しました

WeChat で Google Developers をフォローする

このサイトをで表示しますか?

ページの表示言語としてを選択しましたが、このサイトの言語はに設定されています。

言語設定を変更してこのサイトをで表示しますか?言語設定を変更する場合は、各ページの下にある言語メニューを使用してください。

このクラスには、API レベル 以上が必要です。

API レベル が選択されているため、このドキュメントは非表示になっています。左のナビゲーションの上にあるセレクタを使って、ドキュメントの API レベルを変更できます。

アプリに必要な API レベルを指定する方法について、詳しくは異なるプラットフォーム バージョンのサポートをご覧ください。

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)