private static async Task <NotificationDetails> GetPushDetailsAndPrintOutcome(RedundantNotificationHubClient nhClient, NotificationOutcome notificationOutcome) { if (string.IsNullOrEmpty(notificationOutcome.NotificationId)) { Console.WriteLine($"Fcm has no outcome due to it is only available for Standard SKU pricing tier."); return(null); } var notificationId = notificationOutcome.NotificationId; var state = NotificationOutcomeState.Enqueued; var count = 0; NotificationDetails outcomeDetails = null; while ((state == NotificationOutcomeState.Enqueued || state == NotificationOutcomeState.Processing) && ++count < 10) { try { Console.WriteLine($"Status: {state}"); outcomeDetails = await nhClient.GetNotificationOutcomeDetailsAsync(notificationId); state = outcomeDetails.State; } catch (MessagingEntityNotFoundException) { // It's possible for the notification to not yet be enqueued, so we may have to swallow an exception // until it's ready to give us a new state. } Thread.Sleep(1000); } return(outcomeDetails); }