media/src/main/java/androidx/media/session/MediaButtonReceiver.java
public static PendingIntent buildMediaButtonPendingIntent(Context context,
            @MediaKeyAction long action) {
        ComponentName mbrComponent = getMediaButtonReceiverComponent(context);
        if (mbrComponent == null) {
            Log.w(TAG, "A unique media button receiver could not be found in the given context, so "
                    + "couldn't build a pending intent.");
            return null;
        }
        return buildMediaButtonPendingIntent(context, mbrComponent, action);
    }
/**
     * Creates a broadcast pending intent that will send a media button event. The {@code action}
     * will be translated to the appropriate {@link KeyEvent}, and it will be sent to the
     * registered media button receiver in the given context. The {@code action} should be one of
     * the following:
     * <ul>
     * <li>{@link PlaybackStateCompat#ACTION_PLAY}</li>
     * <li>{@link PlaybackStateCompat#ACTION_PAUSE}</li>
     * <li>{@link PlaybackStateCompat#ACTION_SKIP_TO_NEXT}</li>
     * <li>{@link PlaybackStateCompat#ACTION_SKIP_TO_PREVIOUS}</li>
     * <li>{@link PlaybackStateCompat#ACTION_STOP}</li>
     * <li>{@link PlaybackStateCompat#ACTION_FAST_FORWARD}</li>
     * <li>{@link PlaybackStateCompat#ACTION_REWIND}</li>
     * <li>{@link PlaybackStateCompat#ACTION_PLAY_PAUSE}</li>
     * </ul>
     *
     * @param context The context of the application.
     * @param action The action to be sent via the pending intent.
     * @return Created pending intent, or null if cannot find a unique registered media button
     *         receiver or if the {@code action} is unsupported/invalid.
     */
Creates a broadcast pending intent that will send a media button event. The  action
will be translated to the appropriate  KeyEvent, and it will be sent to the
registered media button receiver in the given context.

@param context The context of the application.
@param action The action to be sent via the pending intent.
@return Created pending intent, or null if cannot find a unique registered media button
receiver or if the  action is unsupported/invalid.
Creates a broadcast pending intent that will send a media button event . The action will be translated to the appropriate KeyEvent and it will be sent to the registered media button receiver in the given context . @param context The context of the application . @param action The action to be sent via the pending intent . @return Created pending intent or null if cannot find a unique registered media button receiver or if the action is unsupported / invalid .
public static PendingIntent buildMediaButtonPendingIntent(Context context,
            @MediaKeyAction long action) {
        ComponentName mbrComponent = getMediaButtonReceiverComponent(context);
        if (mbrComponent == null) {
            Log.w(TAG, "A unique media button receiver could not be found in the given context, so "
                    + "couldn't build a pending intent.");
            return null;
        }
        return buildMediaButtonPendingIntent(context, mbrComponent, action);
    }
public static PendingIntent buildMediaButtonPendingIntent ( Context context , @ MediaKeyAction long action ) { ComponentName mbrComponent = getMediaButtonReceiverComponent ( context ) ; if ( mbrComponent == null ) { Log . w ( TAG , "A unique media button receiver could not be found in the given context, so " + "couldn't build a pending intent." ) ; return null ; } return buildMediaButtonPendingIntent ( context , mbrComponent , action ) ; }
Creates a broadcast pending intent that will send a media button event.
Creates a broadcast pending intent that will send a media button event .