Android APIs
public abstract class

MediaRouteProviderService

extends Service
java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ android.support.v7.media.MediaRouteProviderService

Class Overview

Base class for media route provider services.

To implement your own media route provider service, extend this class and override the onCreateMediaRouteProvider() method to return an instance of your MediaRouteProvider.

Declare your media route provider service in your application manifest like this:

   <service android:name=".MyMediaRouteProviderService"
           android:label="@string/my_media_route_provider_service">
       <intent-filter>
           <action android:name="android.media.MediaRouteProviderService" />
       </intent-filter>
   </service>
 

Summary

Constants
String SERVICE_INTERFACE The Intent that must be declared as handled by the service.
[Expand]
Inherited Constants
From class android.app.Service
From class android.content.Context
From interface android.content.ComponentCallbacks2
Public Constructors
MediaRouteProviderService()
Creates a media route provider service.
Public Methods
MediaRouteProvider getMediaRouteProvider()
Gets the media route provider offered by this service.
IBinder onBind(Intent intent)
Return the communication channel to the service.
abstract MediaRouteProvider onCreateMediaRouteProvider()
Called by the system when it is time to create the media route provider.
boolean onUnbind(Intent intent)
Called when all clients have disconnected from a particular interface published by the service.
[Expand]
Inherited Methods
From class android.app.Service
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.content.ComponentCallbacks2
From interface android.content.ComponentCallbacks

Constants

public static final String SERVICE_INTERFACE

The Intent that must be declared as handled by the service. Put this in your manifest.

Constant Value: "android.media.MediaRouteProviderService"

Public Constructors

public MediaRouteProviderService ()

Creates a media route provider service.

Public Methods

public MediaRouteProvider getMediaRouteProvider ()

Gets the media route provider offered by this service.

Returns
MediaRouteProvider The media route provider offered by this service, or null if it has not yet been created.

public 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.

public abstract MediaRouteProvider onCreateMediaRouteProvider ()

Called by the system when it is time to create the media route provider.

Returns
MediaRouteProvider The media route provider offered by this service, or null if this service has decided not to offer a media route provider.

public boolean onUnbind (Intent intent)

Called when all clients have disconnected from a particular interface published by the service. The default implementation does nothing and returns false.

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
boolean Return true if you would like to have the service's onRebind(Intent) method later called when new clients bind to it.