Esempio n. 1
0
 async Task startOperationAsync(ANotificationReceiver nRec)
 {
     if (useNotifications)
     {
         bool haveFocus = notificationManager.RequestAudioResources(nRec);
         if (haveFocus)
         {
             status.Text = "Granted";
             await nRec.StartAsync();
         }
         else
         {
             status.Text = "Denied";
         }
     }
     else
     {
         await nRec.StartAsync();
     }
 }
            public void OnAudioFocusChange(AudioFocus focusChange)
            {
                switch (focusChange)
                {
                case AudioFocus.GainTransient:
                case AudioFocus.GainTransientMayDuck:
                case AudioFocus.Gain:
                    parent.StartAsync();
                    SetStatus("Granted");
                    break;

                case AudioFocus.LossTransientCanDuck:
                case AudioFocus.LossTransient:
                case AudioFocus.Loss:
                    parent.Stop();
                    SetStatus("Removed");
                    break;

                default:
                    break;
                }
            }