コード例 #1
0
 void stopOperation(ANotificationReceiver nRec)
 {
     nRec.Stop();
     if (useNotifications)
     {
         notificationManager.ReleaseAudioResources();
         status.Text = "Released";
     }
 }
コード例 #2
0
        public Boolean RequestAudioResources(ANotificationReceiver parent)
        {
            listener = new FocusChangeListener(parent);

            var returnVal = audioManager.RequestAudioFocus(listener, Stream.Music, AudioFocus.Gain);

            if (returnVal == AudioFocusRequest.Granted)
            {
                return(true);
            }
            else if (returnVal == AudioFocusRequest.Failed)
            {
                return(false);
            }

            return(false);
        }
コード例 #3
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();
     }
 }
コード例 #4
0
 public FocusChangeListener(ANotificationReceiver parent)
 {
     this.parent = parent;
 }