public IScheduledToastCancellation ScheduleTo(DateTimeOffset deliveryTime)
        {
            var tid = ToastId.New();
            var @do = CalculateDeliveryOffset(deliveryTime);
            var pi  = intentManager.RegisterToShowWithDelay(notificationBuilder, tid);

            var am = AlarmManager.FromContext(Application.Context)
                     ?? throw new InvalidOperationException(ErrorStrings.KAlarmManagerError);

            am.Set(AlarmType.ElapsedRealtimeWakeup, @do, pi);

            return(new AlarmCancellation(pi, tid));
        }
        public Task <NotificationResult> ShowAsync(out ToastId toastId, CancellationToken cancellationToken)
        {
            var tcs      = new TaskCompletionSource <NotificationResult>();
            var view     = options.Activity.FindViewById(global::Android.Resource.Id.Content);
            var snackbar = Snackbar.Make(view, snackbarBuilder.Text, snackbarBuilder.SnackbarDuration);

            if (snackbarBuilder.ActionText != null)
            {
                snackbar.SetAction(snackbarBuilder.ActionText, v => tcs.TrySetResult(NotificationResult.Activated));
            }
            if (snackbarBuilder.ActionTextColor != null)
            {
                snackbar.SetActionTextColor(snackbarBuilder.ActionTextColor.Value);
            }
            snackbar.AddCallback(new Callback(tcs));
            snackbar.Show();
            toastId = ToastId.New();
            if (cancellationToken.CanBeCanceled)
            {
                return(tcs.WatchCancellationAsync(cancellationToken, () => snackbar.Dismiss()));
            }
            return(tcs.Task);
        }
 public Task <NotificationResult> ShowAsync(out ToastId toastId, CancellationToken cancellationToken)
 {
     toastId = ToastId.New();
     return(PrivateShowAsync(toastId, cancellationToken));
 }