【发布时间】:2017-08-24 15:12:52
【问题描述】:
我正在为 windows phone 8.1 开发 One Signal Push Notifications。通知工作正常。但是当我点击通知时,消息显示空值。当应用程序打开时,事件中会显示消息。 如何让通知文本保存在通知屏幕中?
我的 App.Xaml.cs 函数代码在这里。
OnLaunched 事件:
OneSignal.Init("32cdee4b-7838-4b6c-a024-ae25cecb2234", e);
OneSignal.Init("32cdee4b-7838-4b6c-a024-ae25cecb2234", e, notificationOpened);
这里是notificationOpened函数代码:
private async void notificationOpened(string message, IDictionary<string, string> additionalData, bool isActive)
{
if (message != null && message != "")
{
DatabaseHelperClass Db_Helper = new DatabaseHelperClass();//Creating object for DatabaseHelperClass.cs from ViewModel/DatabaseHelperClass.cs
try
{
Db_Helper.Insert(new MessagesClass(message));
}
catch
{
MessageDialog messageDialog = new MessageDialog("There is an error while saving this details. Please try again later!");//Text should not be empty
await messageDialog.ShowAsync();
}
}
else
{
//Here I have check for empty value
settingsClass.SaveSetting("NotiClick", "MoveToMeldingen");
}
当应用程序处于活动状态时,我会收到消息,但是当应用程序处于后台并且通知托盘中收到通知时,单击此我会收到空消息字符串。 请帮助我摆脱这个问题。 谢谢!
【问题讨论】:
标签: c# windows notifications windows-phone-8.1 onesignal