问题
Is there any documentation on what the NotificationOutcome class state looks like on a failure?
NotificationOutcome result = await _hub.SendNotificationAsync(azureNotification, tags);
The MSDN documentation is pretty (completely) useless.
I'm guessing non-zero for result.Failure
and result.Success
means something went wrong (both seem to be 0 on a success) result.State
is maybe more useful but there doesn't seem to be much documentation on this either
回答1:
I've found the answer on this page
If the EnableTestSend property is set to false for a NotificationHubClient object, all Send* methods return a NotificationOutcome instance with State set to Enqueued, and no additional information. If EnableTestSend is true, State will be set to DetailedStateAvailable, and this class contains information about how many notifications were successfully delivered. In case of failures, it provides the specific outcome, in the same manner as the notification hub telemetry.
That means that Success and Failure mean the number of succeeded and failed notifications and will exist only if EnableTestSend parameter was set to true on client creation.
来源:https://stackoverflow.com/questions/25224204/what-happens-when-an-azure-push-notification-fails-to-send