public class

MediaNotificationService

extends Service
java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ com.google.android.gms.cast.framework.media.MediaNotificationService

Class Overview

A service to provide status bar notifications when casting. This service will start when a media session begins, and will stop when the media session ends. This service builds media-style notification, which includes an album art image, a title and up to 5 action buttons, based on the options provided in NotificationOptions.

The album art image is picked from the list of images of the MediaMetadata of the current item. If getImagePicker() is provided it will be used to pick the image, with the type IMAGE_TYPE_NOTIFICATION_THUMBNAIL. If no image is available, cast_album_art_placeholder and cast_album_art_placeholder_large will be used, depending on the screen size. They can be overridden by the application.

The title is set to the value keyed by KEY_TITLE in the metadata of the current item.

The list of action buttons is set to getActions(), see MediaIntentReceiver for the list of available actions.

The notification icon in the status bar is set to cast_ic_notification_small_icon. This can be overridden by the application.

The Notification will only be shown when the app is in the background.

Summary

Constants
String ACTION_UPDATE_NOTIFICATION The action for updating the notification.
[Expand]
Inherited Constants
From class android.app.Service
From class android.content.Context
From interface android.content.ComponentCallbacks2
Public Constructors
MediaNotificationService()
Public Methods
IBinder onBind(Intent intent)
void onCreate()
void onDestroy()
int onStartCommand(Intent intent, int flags, int startId)
[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 ACTION_UPDATE_NOTIFICATION

The action for updating the notification.

Constant Value: "com.google.android.gms.cast.framework.action.UPDATE_NOTIFICATION"

Public Constructors

public MediaNotificationService ()

Public Methods

public IBinder onBind (Intent intent)

Parameters
intent Intent
Returns
IBinder

public void onCreate ()

public void onDestroy ()

public int onStartCommand (Intent intent, int flags, int startId)

Parameters
intent Intent
flags int
startId int
Returns
int