Пример #1
0
            public void OnServiceDisconnected(ComponentName name)
            {
                IsPlayerBound = false;

                if (_audioPlaybackBinder.IsBinderAlive)
                    _audioPlaybackBinder.Dispose();
                _audioPlaybackBinder = null;
            }
Пример #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);
            }
Пример #3
0
            public void StopService()
            {
                IsPlayerBound = false;
               
                try
                {
                    Context.UnbindService(this);
                    _audioPlaybackBinder.Dispose();
                    _audioPlaybackBinder = null;
                }
                catch
                {
                }

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