protected override void OnDestroy() { base.OnDestroy(); _musicPlayerService?.Stop(); DoUnbindService(); }
public void OnClick(View v) { if (v.Equals(_btnPlay)) { if (_musicPlayerService.MediaPlayer == null && Connectivity.IsConnected(ApplicationContext)) { _btnPlay.SetImageResource(Resource.Drawable.ic_pause_circle_outline_white_48dp); _musicPlayerService.Play(); } else if (_musicPlayerService.MediaPlayer != null) { _btnPlay.SetImageResource(Resource.Drawable.ic_play_circle_outline_white_48dp); _musicPlayerService.Stop(); } } }
public void OnClick(View v) { if (v.Equals(_btnPlay)) { if (_musicPlayerService?.MediaPlayer == null && Connectivity.IsConnected(ApplicationContext)) { _btnPlay.SetImageResource(Resource.Drawable.ic_pause_circle_outline_dark_blue_48dp); Intent intent = new Intent(this, typeof(MusicPlayerService)); _musicPlayerService.StartService(intent); _musicPlayerService.Play(); } else if (_musicPlayerService?.MediaPlayer != null) { _btnPlay.SetImageResource(Resource.Drawable.ic_play_circle_outline_dark_blue_48dp); _musicPlayerService.Stop(); } } }
public void Stop() { MusicPlayerService.Stop(); _missedTimer.Stop(); IsRunning = false; }