Tabnine Logo
MediaSessionManager.removeOnActiveSessionsChangedListener
Code IndexAdd Tabnine to your IDE (free)

How to use
removeOnActiveSessionsChangedListener
method
in
android.media.session.MediaSessionManager

Best Java code snippets using android.media.session.MediaSessionManager.removeOnActiveSessionsChangedListener (Showing top 2 results out of 315)

origin: rockon999/LeanbackLauncher

public synchronized void setRemoteControlListener(Listener listener) throws RemoteException {
  if (Log.isLoggable("NowPlayCardListener", 3)) {
    Log.d("NowPlayCardListener", "setRemoteControlListener: " + listener);
  }
  MediaSessionManager manager = (MediaSessionManager) this.mContext.getApplicationContext().getSystemService("media_session");
  if (listener != null) {
    manager.addOnActiveSessionsChangedListener(this, null);
    this.mNowPlayCardListener = listener;
    checkForMediaSession();
  } else {
    manager.removeOnActiveSessionsChangedListener(this);
    this.mNowPlayCardListener = null;
    updateMediaSessionCallback(null);
  }
}
origin: tomahawk-player/tomahawk-android

/**
 * Disables RemoteController.
 */
public void setRemoteControllerDisabled() {
  Log.d(TAG, "setRemoteControllerDisabled");
  if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
    Object service = TomahawkApp.getContext().getSystemService(Context.AUDIO_SERVICE);
    if (service instanceof AudioManager
        && ((AudioManager) service).registerRemoteController(mRemoteController)) {
      ((AudioManager) service).unregisterRemoteController(mRemoteController);
    }
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    Object service =
        TomahawkApp.getContext().getSystemService(Context.MEDIA_SESSION_SERVICE);
    if (service instanceof MediaSessionManager) {
      MediaSessionManager manager = (MediaSessionManager) service;
      if (mSessionsChangedListener != null) {
        manager.removeOnActiveSessionsChangedListener(mSessionsChangedListener);
      }
      synchronized (this) {
        unregisterSessionCallbacks();
        mActiveSessions = new ArrayList<>();
      }
    }
  }
}
android.media.sessionMediaSessionManagerremoveOnActiveSessionsChangedListener

Popular methods of MediaSessionManager

  • getActiveSessions
  • addOnActiveSessionsChangedListener

Popular in Java

  • Reading from database using SQL prepared statement
  • notifyDataSetChanged (ArrayAdapter)
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Path (java.nio.file)
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • JList (javax.swing)
  • Top Sublime Text plugins
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