Beispiel #1
0
        private void OnPlayButtonClick(object sender, EventArgs e)
        {
            Events.Click("Media Button", new { _service.IsPlaying });

            if (_service.IsPlaying)
            {
                _service.Stop();
            }
            else
            {
                var intent = new Intent(ApplicationContext, typeof(RadioStationService)).SetAction(RadioStationService.ActionPlay);

                if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
                {
                    StartForegroundService(intent);
                }
                else
                {
                    StartService(intent);
                }
            }
        }