Tabnine Logo
RemoteControlClient.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
android.media.RemoteControlClient
constructor

Best Java code snippets using android.media.RemoteControlClient.<init> (Showing top 7 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

void windowAttached() {
  mContext.registerReceiver(mMediaButtonReceiver, mReceiverFilter);
  mPendingIntent = PendingIntent.getBroadcast(mContext, 0, mIntent,
      PendingIntent.FLAG_CANCEL_CURRENT);
  mRemoteControl = new RemoteControlClient(mPendingIntent);
  mRemoteControl.setOnGetPlaybackPositionListener(this);
  mRemoteControl.setPlaybackPositionUpdateListener(this);
}
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: 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: dibakarece/DMAudioStreamer

mediaButtonIntent.setComponent(remoteComponentName);
PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(this, 0, mediaButtonIntent, 0);
remoteControlClient = new RemoteControlClient(mediaPendingIntent);
audioManager.registerRemoteControlClient(remoteControlClient);
origin: andreadec/MusicPlayer

PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent, 0);
remoteControlClient = new RemoteControlClient(mediaPendingIntent);
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.mediaRemoteControlClient<init>

Popular methods of RemoteControlClient

  • setTransportControlFlags
  • setPlaybackState
  • editMetadata
  • setOnGetPlaybackPositionListener
  • setPlaybackPositionUpdateListener

Popular in Java

  • Reading from database using SQL prepared statement
  • putExtra (Intent)
  • onCreateOptionsMenu (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JLabel (javax.swing)
  • Top plugins for Android Studio
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