Tabnine Logo
RemoteControlClient.setTransportControlFlags
Code IndexAdd Tabnine to your IDE (free)

How to use
setTransportControlFlags
method
in
android.media.RemoteControlClient

Best Java code snippets using android.media.RemoteControlClient.setTransportControlFlags (Showing top 11 results out of 315)

origin: naman14/Timber

@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void setUpRemoteControlClient() {
  //Legacy for ICS
  if (mRemoteControlClient == null) {
    Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
    mediaButtonIntent.setComponent(mMediaButtonReceiverComponent);
    PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(this, 0, mediaButtonIntent, 0);
    // create and register the remote control client
    mRemoteControlClient = new RemoteControlClient(mediaPendingIntent);
    mAudioManager.registerRemoteControlClient(mRemoteControlClient);
  }
  mRemoteControlClient.setTransportControlFlags(
      RemoteControlClient.FLAG_KEY_MEDIA_PLAY |
          RemoteControlClient.FLAG_KEY_MEDIA_PAUSE |
          RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS |
          RemoteControlClient.FLAG_KEY_MEDIA_NEXT |
          RemoteControlClient.FLAG_KEY_MEDIA_STOP);
}
origin: kingargyle/adt-leanback-support

public void refreshState(boolean playing, long position, int transportControls) {
  if (mRemoteControl != null) {
    mRemoteControl.setPlaybackState(playing ? RemoteControlClient.PLAYSTATE_PLAYING
        : RemoteControlClient.PLAYSTATE_STOPPED, position, playing ? 1 : 0);
    mRemoteControl.setTransportControlFlags(transportControls);
  }
}
origin: vanilla-music/vanilla

/**
 * Perform initialization required for RemoteControlClient.
 */
public void initializeRemote() {
  // make sure there is only one registered remote
  unregisterRemote();
  if (MediaButtonReceiver.useHeadsetControls(mContext) == false)
    return;
  // Receive 'background' play button events
  AudioManager audioManager = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
  ComponentName receiver = new ComponentName(mContext.getPackageName(), MediaButtonReceiver.class.getName());
  audioManager.registerMediaButtonEventReceiver(receiver);
  Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
  mediaButtonIntent.setComponent(new ComponentName(mContext.getPackageName(), MediaButtonReceiver.class.getName()));
  PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(mContext, 0, mediaButtonIntent, 0);
  RemoteControlClient remote = new RemoteControlClient(mediaPendingIntent);
  // Things we can do (eg: buttons to display on lock screen)
  int flags = RemoteControlClient.FLAG_KEY_MEDIA_NEXT
    | RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS
    | RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE
    | RemoteControlClient.FLAG_KEY_MEDIA_PLAY
    | RemoteControlClient.FLAG_KEY_MEDIA_PAUSE;
  remote.setTransportControlFlags(flags);
  audioManager.registerRemoteControlClient(remote);
  mRemote = remote;
}
origin: recoilme/freemp

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
void registerRemoteControl(ComponentName rcvMedia) {
  mAudioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC,
      AudioManager.AUDIOFOCUS_GAIN);
  Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
  mediaButtonIntent.setComponent(rcvMedia);
  PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(getApplicationContext(),
      0, mediaButtonIntent, 0);
  remoteControlClient = new RemoteControlClient(mediaPendingIntent);
  remoteControlClient.setTransportControlFlags(
      RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE |
          RemoteControlClient.FLAG_KEY_MEDIA_NEXT |
          RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS
  );
  mAudioManager.registerRemoteControlClient(remoteControlClient);
}
origin: stackoverflow.com

       | RemoteControlClient.FLAG_KEY_MEDIA_FAST_FORWARD
       | RemoteControlClient.FLAG_KEY_MEDIA_REWIND;
mRemoteControlClient.setTransportControlFlags(flags);
mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
origin: stackoverflow.com

 AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
    audioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC,
        AudioManager.AUDIOFOCUS_GAIN);
    Bitmap AlbumArt=BitmapFactory.decodeResource(getResources(), R.drawable.alislahthumbmain);
    mIslahReceiverComponent=new ComponentName(this,AlIslahReceiver.class.getName());
audioManager.registerMediaButtonEventReceiver(mIslahReceiverComponent);
    Intent mediaButtonIntent=new Intent(Intent.ACTION_MEDIA_BUTTON);
    mediaButtonIntent.setComponent(mIslahReceiverComponent);
    PendingIntent mediaPendingIntent=PendingIntent.getBroadcast(getApplicationContext(),
        0,mediaButtonIntent,0);
    RemoteControlClient mRemoteControlClient=new RemoteControlClient(mediaPendingIntent);
    mRemoteControlClient.editMetadata(true)
    .putString(MediaMetadataRetriever.METADATA_KEY_TITLE,AlIslahApplication.getStreamTitle())
    .putBitmap(100,AlbumArt)
    .apply();
    mRemoteControlClient.setPlaybackState(
        RemoteControlClient.PLAYSTATE_PLAYING);
    mRemoteControlClient.setTransportControlFlags(
        RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE|
        RemoteControlClient.FLAG_KEY_MEDIA_STOP);
    audioManager.registerRemoteControlClient(mRemoteControlClient);
origin: dibakarece/DMAudioStreamer

  audioManager.registerRemoteControlClient(remoteControlClient);
remoteControlClient.setTransportControlFlags(RemoteControlClient.FLAG_KEY_MEDIA_PLAY | RemoteControlClient.FLAG_KEY_MEDIA_PAUSE
    | RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE | RemoteControlClient.FLAG_KEY_MEDIA_STOP
    | RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS | RemoteControlClient.FLAG_KEY_MEDIA_NEXT);
origin: recoilme/freemp

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
void updateRemoteControl() {
  updateRemoteControlState(RemoteControlClient.PLAYSTATE_PLAYING);
  remoteControlClient.setTransportControlFlags(
      RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS |
          RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE |
origin: googlesamples/android-MediaRouter

private void unregisterRemoteControlClient() {
  // Unregister the RCC with AudioManager and MediaRouter
  if (mRemoteControlClient != null) {
    mRemoteControlClient.setTransportControlFlags(0);
    mAudioManager.abandonAudioFocus(mAfChangeListener);
    mAudioManager.unregisterMediaButtonEventReceiver(mEventReceiver);
    mAudioManager.unregisterRemoteControlClient(mRemoteControlClient);
    mMediaRouter.removeRemoteControlClient(mRemoteControlClient);
    SampleMediaButtonReceiver.setActivity(null);
    mRemoteControlClient = null;
  }
}
origin: andreadec/MusicPlayer

remoteControlClient.setTransportControlFlags(RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE | RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS | RemoteControlClient.FLAG_KEY_MEDIA_NEXT);
audioManager.registerRemoteControlClient(remoteControlClient);
origin: googlesamples/android-MediaRouter

private void registerRemoteControlClient() {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    // Create the RCC and register with AudioManager and MediaRouter
    mAudioManager.requestAudioFocus(mAfChangeListener, AudioManager.STREAM_MUSIC,
        AudioManager.AUDIOFOCUS_GAIN);
    mAudioManager.registerMediaButtonEventReceiver(mEventReceiver);
    mRemoteControlClient = new RemoteControlClient(mMediaPendingIntent);
    mAudioManager.registerRemoteControlClient(mRemoteControlClient);
    mMediaRouter.addRemoteControlClient(mRemoteControlClient);
    SampleMediaButtonReceiver.setActivity(MainActivity.this);
    mRemoteControlClient.setTransportControlFlags(RemoteControlClient
        .FLAG_KEY_MEDIA_PLAY_PAUSE);
    mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
  }
}
android.mediaRemoteControlClientsetTransportControlFlags

Popular methods of RemoteControlClient

  • <init>
  • setPlaybackState
  • editMetadata
  • setOnGetPlaybackPositionListener
  • setPlaybackPositionUpdateListener

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • findViewById (Activity)
  • setScale (BigDecimal)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Collectors (java.util.stream)
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now