How can I set up my push notifications so the user can select which notification to subscribe to? For example take a weather app, User A wants to subscribe to notification when a tornado is approaching, but User B doesn't care about that, and only wants to be notified if flood is approaching. So in the app there is a setting to allow users to subscribe to either or both of these notifications.
Now on my backend I have a webjob that is gathering the weather data from online sources and store in SQL database, I create a notification hub in Azure, and add code to my webjob like this example
private static async void SendNotificationAsync()
{
NotificationHubClient hub = NotificationHubClient
.CreateClientFromConnectionString("<connection string with full access>", "<hub name>");
var toast = @"<toast><visual><binding template=""ToastText01""><text id=""1"">Hello from a .NET App!</text></binding></visual></toast>";
await hub.SendWindowsNativeNotificationAsync(toast);
}
When I get certain weather data that indicated Flood or Tornado can I do something like this to send the notification
if(flood)
SendNotificationAsync(flood) //only sends notification to User B
else if(tornado)
SendNotificationAsync(tornado) //only send notification to User A
Can this be accomplished using a single notification hub? Or do I have to create multiple hubs?