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);
 }
        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);
        }
예제 #3
0
        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();
        }
예제 #4
0
        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();
        }
예제 #5
0
        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);
                    }
                }
            }
        }