Esempio n. 1
0
            public void OnServiceDisconnected(ComponentName name)
            {
                IsPlayerBound = false;

                if (_audioPlaybackBinder.IsBinderAlive)
                {
                    _audioPlaybackBinder.Dispose();
                }
                _audioPlaybackBinder = null;
            }
Esempio n. 2
0
            public void OnServiceConnected(ComponentName name, IBinder service)
            {
                var audioPlaybackBinder = (AudioPlaybackService.AudioPlaybackBinder)service;

                if (audioPlaybackBinder == null)
                {
                    Current._startPlaybackCompletionSource.SetResult(false);
                    return;
                }

                _audioPlaybackBinder = audioPlaybackBinder;
                IsPlayerBound        = true;
                _audioPlaybackBinder.GetPlaybackService().InitMusicPlayer();
                Current._startPlaybackCompletionSource.SetResult(true);
            }
Esempio n. 3
0
            public void StopService()
            {
                IsPlayerBound = false;

                try
                {
                    Context.UnbindService(this);
                    _audioPlaybackBinder.Dispose();
                    _audioPlaybackBinder = null;
                }
                catch
                {
                }

                Context.StopService(new Intent(Context, typeof(AudioPlaybackService)));
            }