void stopOperation(ANotificationReceiver nRec) { nRec.Stop(); if (useNotifications) { notificationManager.ReleaseAudioResources(); status.Text = "Released"; } }
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); }
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 FocusChangeListener(ANotificationReceiver parent) { this.parent = parent; }