1
Hello, How can I use Azure to notify the user that you have new content in the app? I am creating a project on c#
for Windows 10
. Thanks in advance.
1
Hello, How can I use Azure to notify the user that you have new content in the app? I am creating a project on c#
for Windows 10
. Thanks in advance.
3
You must use the service of Azure Notification Hub.
Push notifications to any platform and back-end
To trigger back-end notification:
var hub = NotificationHubClient
.CreateClientFromConnectionString("Endpoint=sb://NOME_DO_SEU_APP.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=CHAVE_DO_SEU_APP",
"NOME_DO_SEU_APP");
var toast = @"<toast><visual><binding template=""ToastText01""><text id=""1"">Bem vindos ao VSSummit 2015</text></binding></visual></toast>";
var toastWithImage = @"<toast><visual><binding template=""ToastImageAndText01""><image id=""1"" src=""https://cdn1.iconfinder.com/data/icons/metro-ui-icon-set/512/Visual_Studio_2012.png"" /><text id=""1"">Bem vindos ao VSSummit15!</text></binding></visual></toast>";
hub.SendWindowsNativeNotificationAsync(toast).Wait();
There are other models/templates simple message, with or without image, with or without title, with counters, etc. See more models of Toast Notifications.
And to make your app receive notifications:
private async void InitNotificationHubAsync()
{
var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
var hub = new NotificationHub("NOME_DO_SEU_APP", "Endpoint=sb://NOME_DO_SEU_APP.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=CHAVE_COMPARTILHADA_DO_SEU_APP");
await hub.RegisterNativeAsync(channel.Uri);
}
In the my Github repository has an example of how to consume the service:
Browser other questions tagged c# windows-phone windows-azure push-notification windows-10
You are not signed in. Login or sign up in order to post.
Thanks for the help Thiago :D
– Leandrolap
I followed the tutorial to the letter. In debug mode, everything works perfect. Then I send the app to the store, down and open it. At this point it closes without explanation. I have already done the test and if you remove the code, the app works correctly again. Any hints?
– Washington Morais
Well, there’s not much to say. You just need a way to get the Exception that’s going on and send it to you. There are some tutos on the web explaining - I don’t have any to recommend. Try running RELEASE on your device, see if anything changes. If you don’t solve, implement Azure Application Insights, it can pick up some app behaviors.
– Thiago Lunardi
@Leandrolap, if you agree, can mark the answer as the ideal, please? :)
– Thiago Lunardi
Azure Notifications hub serves to push Notifications to a pwa? web application in case it would be in angular
– Sérgio S. Filho