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

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

Best Java code snippets using android.media.session.MediaSessionManager.addOnActiveSessionsChangedListener (Showing top 3 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: KDE/kdeconnect-android

@Override
public boolean onCreate() {
  if (!hasPermission())
    return false;
  players = new HashMap<>();
  try {
    MediaSessionManager manager = (MediaSessionManager) context.getSystemService(Context.MEDIA_SESSION_SERVICE);
    if (null == manager)
      return false;
    manager.addOnActiveSessionsChangedListener(MprisReceiverPlugin.this, new ComponentName(context, NotificationReceiver.class), new Handler(Looper.getMainLooper()));
    createPlayers(manager.getActiveSessions(new ComponentName(context, NotificationReceiver.class)));
    sendPlayerList();
  } catch (Exception e) {
    Log.e(TAG, "Exception", e);
  }
  return true;
}
origin: tomahawk-player/tomahawk-android

manager.addOnActiveSessionsChangedListener(mSessionsChangedListener, componentName);
synchronized (this) {
  mActiveSessions = manager.getActiveSessions(componentName);
android.media.sessionMediaSessionManageraddOnActiveSessionsChangedListener

Popular methods of MediaSessionManager

  • getActiveSessions
  • removeOnActiveSessionsChangedListener

Popular in Java

  • Start an intent from android
  • getSystemService (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setRequestProperty (URLConnection)
  • Kernel (java.awt.image)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • 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