MediaNotificationService

public class MediaNotificationService extends Service

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 CastMediaOptions.getImagePicker() is provided it will be used to pick the image, with the type ImagePicker.IMAGE_TYPE_NOTIFICATION_THUMBNAIL. If no image is available, R.drawable.cast_album_art_placeholder and R.drawable.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 MediaMetadata.KEY_TITLE in the metadata of the current item.

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

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

Constant Summary

String ACTION_UPDATE_NOTIFICATION The action for updating the notification.

Inherited Constant Summary

Public Constructor Summary

Public Method Summary

static boolean
isNotificationOptionsValid(CastOptions options)
Returns true if NotificationOptions in the CastOptions provides valid actions.
IBinder
onBind(Intent intent)
void
void
int
onStartCommand(Intent intent, int flags, int startId)

Inherited Method Summary

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 static boolean isNotificationOptionsValid (CastOptions options)

Returns true if NotificationOptions in the CastOptions provides valid actions.

public IBinder onBind (Intent intent)

public void onCreate ()

public void onDestroy ()

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