我正在按照本教程使用 UWP 应用程序的通知中心:Getting started with Notification Hubs for Windows Universal Platform Apps .
如果我测试发送 Windows 8 通知,例如:
<?xml version="1.0" encoding="utf-8"?>
<toast>
<visual><binding template="ToastText01">
<text id="1">Test message</text>
</binding>
</visual>
</toast>
它有效,如果我单击通知,它会通过 OnLaunched() 方法打开应用程序。但如果我发送 UWP 特定通知,例如:
<toast launch="app-defined-string">
<visual>
<binding template="ToastGeneric">
<text>Microsoft Company Store</text>
<text>New Halo game is back in stock!</text>
</binding>
</visual>
<actions>
<action activationType="foreground" content="See more details" arguments="details"/>
<action activationType="background" content="Remind me later" arguments="later"/>
</actions>
</toast>
toast 可以工作,但如果我点击它,它会打开应用程序,并且 OnLaunched() 从未调用,因此应用程序卡在启动屏幕上。
预先感谢您的帮助,
问候
最佳答案
您需要在 app.xaml.cs 中实现 OnActivated
protected override void OnActivated(IActivatedEventArgs args)
{
base.OnActivated(args);
}
关于Azure通知中心UWP、UWP Toast通知不启动应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41715738/