Package com.google.android.exoplayer2.ui
Interface PlayerNotificationManager.CustomActionReceiver
-
- Enclosing class:
- PlayerNotificationManager
public static interface PlayerNotificationManager.CustomActionReceiver
Defines and handles custom actions.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map<String,androidx.core.app.NotificationCompat.Action>
createCustomActions(Context context, int instanceId)
Gets the actions handled by this receiver.List<String>
getCustomActions(Player player)
Gets the actions to be included in the notification given the current player state.void
onCustomAction(Player player, String action, Intent intent)
Called when a custom action has been received.
-
-
-
Method Detail
-
createCustomActions
Map<String,androidx.core.app.NotificationCompat.Action> createCustomActions(Context context, int instanceId)
Gets the actions handled by this receiver.If multiple
PlayerNotificationManager
instances are in use at the same time, theinstanceId
must be set as an intent extra with keyPlayerNotificationManager.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 theIntent
attributes considered byIntent.filterEquals(android.content.Intent)
, or different request code integers when creating thePendingIntent
s withPendingIntent.getBroadcast(android.content.Context, int, android.content.Intent, int)
. The easiest approach is to use theinstanceId
as the request code.- Parameters:
context
- TheContext
.instanceId
- The instance id of thePlayerNotificationManager
.- Returns:
- A map of custom actions.
-
getCustomActions
List<String> getCustomActions(Player player)
Gets the actions to be included in the notification given the current player state.- Parameters:
player
- ThePlayer
for which a notification is being built.- Returns:
- The actions to be included in the notification.
-
onCustomAction
void onCustomAction(Player player, String action, Intent intent)
Called when a custom action has been received.- Parameters:
player
- The player.action
- The action fromIntent.getAction()
.intent
- The receivedIntent
.
-
-