I am trying to store failed notifications in a db
, e.g. client does not have internet access. This will enable me to check from a backgroundService
if there is a missing notification, and then create it from the backgroundService
.
I therefore have the following, on my Azure App Service Mobile
:
var notStat = await hub.SendWindowsNativeNotificationAsync(wnsToast, tag);
telemetry.TrackTrace("failure : " + notStat.Failure + " | Results : " + notStat.Results + " | State : " + notStat.State + " | Success : " + notStat.Success + " | trackingID : " + notStat.TrackingId + ");
The code snippet was to test the impact from the client, but no matter what I do the resulting log is just that the message was enqueued
.
Question
So how to I detect failed Notifications?
Conclusion
To sum up the discussions made to the accepted answer:
When the notification has been send, the NotificationId
and other relevant data, is stored in a separate Table.
The event on the client receiving the notification, will then send a message to the server stating that the notification is received. The entry is then removed from the Table.
The notifications that then are not received by the client, will through a background task
be found. This will be every time the background task
fires, e.g. every 6 hours, the background task
will retrieve all the missing notifications. This enables the background task
to create the relevant notifications and the user will not miss any notification.