PlayerNotificationManager.CustomActionReceiver


public interface PlayerNotificationManager.CustomActionReceiver


Defines and handles custom actions.

Summary

Public methods

abstract Map<StringNotificationCompat.Action>
createCustomActions(Context context, int instanceId)

Gets the actions handled by this receiver.

abstract List<String>

Gets the actions to be included in the notification given the current player state.

abstract void
onCustomAction(Player player, String action, Intent intent)

Called when a custom action has been received.

Public methods

createCustomActions

abstract Map<StringNotificationCompat.ActioncreateCustomActions(Context context, int instanceId)

Gets the actions handled by this receiver.

If multiple PlayerNotificationManager instances are in use at the same time, the instanceId must be set as an intent extra with key EXTRA_INSTANCE_ID to avoid sending the action to every custom action receiver. It's also necessary to ensure something is different about the actions. This may be any of the Intent attributes considered by filterEquals, or different request code integers when creating the PendingIntents with getBroadcast. The easiest approach is to use the instanceId as the request code.

Parameters
Context context

The Context.

int instanceId

The instance id of the PlayerNotificationManager.

Returns
Map<StringNotificationCompat.Action>

A map of custom actions.

getCustomActions

abstract List<StringgetCustomActions(Player player)

Gets the actions to be included in the notification given the current player state.

Parameters
Player player

The Player for which a notification is being built.

Returns
List<String>

The actions to be included in the notification.

onCustomAction

abstract void onCustomAction(Player player, String action, Intent intent)

Called when a custom action has been received.

Parameters
Player player

The player.

String action

The action from getAction.

Intent intent

The received Intent.