Exemple #1
0
            public void OnServiceDisconnected(ComponentName name)
            {
                IsPlayerBound = false;

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

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