public MediaNotificationManagerImplementation(Context appliactionContext, MediaSessionCompat.Token sessionToken, Type serviceType) { _sessionToken = sessionToken; _appliactionContext = appliactionContext; _intent = new Intent(_appliactionContext, serviceType); var mainActivity = _appliactionContext.PackageManager.GetLaunchIntentForPackage(_appliactionContext.PackageName); _pendingIntent = PendingIntent.GetActivity(_appliactionContext, 0, mainActivity, PendingIntentFlags.UpdateCurrent); }
private void ConnectToSession(MediaSessionCompat.Token token) { SupportMediaController = new MediaControllerCompat(this, token); if (ShouldShowControls) { ShowPlaybackControls(); } else { LogHelper.Debug(Tag, "connectionCallback.onConnected: " + "hiding controls because metadata is null"); HidePlaybackControls(); } OnConnected(); }
void ConnectToSession(MediaSessionCompat.Token token) { var controller = new MediaControllerCompat(this, token); this.SupportMediaController = controller; controller.RegisterCallback(callBack = new MediaControllerCallBack { Parent = this }); if (ShouldShowControls()) { ShowPlaybackControls(); } else { HidePlaybackControls(); } ControlsFragment?.OnConnected(); OnMediaControllConnected(); }
void UpdateSessionToken() { var freshToken = Service.SessionToken; if (freshToken == null || sessionToken == freshToken) { return; } controller?.UnregisterCallback(callback); sessionToken = freshToken; controller = new MediaControllerCompat(Service, sessionToken); transportControls = controller.GetTransportControls(); if (started) { controller.RegisterCallback(callback); } }
void UpdateSessionToken() { var freshToken = service.SessionToken; if (sessionToken == null && freshToken != null || sessionToken != null && sessionToken != freshToken) { controller?.UnregisterCallback(mCb); sessionToken = freshToken; if (sessionToken != null) { controller = new MediaControllerCompat(service, sessionToken); transportControls = controller.GetTransportControls(); if (started) { controller.RegisterCallback(mCb); } } } }