public void OnServiceDisconnected(ComponentName name) { IsPlayerBound = false; if (_audioPlaybackBinder.IsBinderAlive) { _audioPlaybackBinder.Dispose(); } _audioPlaybackBinder = null; }
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); }
public void StopService() { IsPlayerBound = false; try { Context.UnbindService(this); _audioPlaybackBinder.Dispose(); _audioPlaybackBinder = null; } catch { } Context.StopService(new Intent(Context, typeof(AudioPlaybackService))); }