PlaybackNotificationImpl
Base class for creating and updating a media-style notification.
Action customization
Playback actions can be included or omitted as follows:
usePlayPauseActions
- Sets whether the play and pause actions are used.Corresponding setter: PlaybackNotificationConfig.setUsePlayPauseActions
Default:
true
useRewindAction
- Sets whether the rewind action is used.Corresponding setter: PlaybackNotificationConfig.setUseRewindAction
Default:
true
useRewindActionInCompactView
- IfuseRewindAction
istrue
, sets whether the rewind action is also used in compact view (including the lock screen notification). Else does nothing.Corresponding setter: PlaybackNotificationConfig.setUseRewindActionInCompactView
Default:
false
useFastForwardAction
- Sets whether the fast forward action is used.Corresponding setter: PlaybackNotificationConfig.setUseFastForwardAction
Default:
true
useFastForwardActionInCompactView
- IfuseFastForwardAction
istrue
, sets whether the fast forward action is also used in compact view (including the lock screen notification). Else does nothing.Corresponding setter: PlaybackNotificationConfig.setUseFastForwardActionInCompactView
Default:
false
usePreviousAction
- Whether the previous action is used.Corresponding setter: PlaybackNotificationConfig.setUsePreviousAction
Default:
true
usePreviousActionInCompactView
- IfusePreviousAction
istrue
, sets whether the previous action is also used in compact view (including the lock screen notification). Else does nothing.Corresponding setter: PlaybackNotificationConfig.setUsePreviousActionInCompactView
Default:
false
useNextAction
- Whether the next action is used.Corresponding setter: PlaybackNotificationConfig.setUseNextAction
Default:
true
useNextActionInCompactView
- IfuseNextAction
istrue
, sets whether the next action is also used in compact view (including the lock screen notification). Else does nothing.Corresponding setter: PlaybackNotificationConfig.setUseNextActionInCompactView
Default:
false
Overriding drawables
The action icons can be set programatically by using the PlaybackNotificationConfig. The large icon (i.e. the icon passed to Notification.Builder.setLargeIcon is obtained from the MediaDescriptionAdapter passed to PlaybackNotificationConfig.setAdapter
notification.setConfig(new MediaPlaybackNotification.Config(this) .setSmallIcon(R.mipmap.ic_launcher) .setUseNextAction(false) .setPriority(NotificationCompat.PRIORITY_MAX) . setAdapter(new MediaPlaybackNotification.MediaDescriptionAdapter() { @Override public CharSequence getCurrentContentTitle(MediaPlayback playback) { return "Your custom title"; } @Nullable @Override public Bitmap getCurrentLargeIcon(MediaPlayback playback, BitmapCallback callback) { // TODO: return your bitmap } }) );*