这可能是一个重复的问题。但是我还没有找到任何解决方案。您能否提供任何示例或示例代码来在uwp 10上注册App进行PUSH NOTIFICATION?
需要客户端代码,推送通知类型为“服务器到客户端”。客户端应注册接收服务器推送并处理来自服务器的推送。
我已经实现了推送通知。因此,它可能会帮助某人。在App.xaml.cs中添加新方法:
private async Task InitNotificationsAsync()
{
// Get a channel URI from WNS.
var channel = await PushNotificationChannelManager
.CreatePushNotificationChannelForApplicationAsync();
channel.PushNotificationReceived += Channel_PushNotificationReceived;
}
在方法内部调用此OnLaunched
方法:
protected async override void OnLaunched(LaunchActivatedEventArgs e)
{
await InitNotificationsAsync();
...
}
希望这会有所帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句