OneSignal Push Notification ClickEvent show empty values Windows phone 8.1 C#(OneSignal 推送通知 ClickEvent 显示空值 Windows phone 8.1 C#)
问题描述
我正在为 Windows Phone 8.1 开发 One Signal Push Notifications.通知工作正常.但是当我点击通知时,消息显示空值.当应用程序打开时,则在事件中显示消息.如何获取通知文本以保存在我的通知屏幕中?
I'm working on One Signal Push Notifications for windows phone 8.1. Notification works fine. but when I click on notification then the message display empty value. While when application is ON then message display in event. how can I get the notification text to save in my notification screen?
我的 App.Xaml.cs 函数代码在这里.
My App.Xaml.cs Function code is here.
启动事件:
OneSignal.Init("32cdee4b-7838-4b6c-a024-ae25cecb2234", e);
OneSignal.Init("32cdee4b-7838-4b6c-a024-ae25cecb2234", e, notificationOpened);
这是notificationOpened函数代码:
Here is notificationOpened Function Code:
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");
}
当应用程序处于活动状态时,我会收到消息,但是当应用程序处于后台并且通知在通知托盘中收到时,单击此按钮我会收到空消息字符串.请帮助我摆脱这个问题.谢谢!
When application is on active state then I gets the message but when application is in background and notification receives in notification tray then y clicking on this I gets empty message string. Please help me to get rid of this issue. Thank you!
推荐答案
这是 Windows Phone 8.1 通知的一个限制,其中消息正文未传递到应用程序.问题是传递给 OnLaunched
的 LaunchActivatedEventArgs
不包含此值,因此 OneSignal SDK 无法获取此值.您可以设置一个断点或打印出 e.Arguments
以查看它 WP8.1 没有通过它.
It is a limitation of Windows Phone 8.1 notifications where the message body isn't passed to the app. The issue is that LaunchActivatedEventArgs
passed to OnLaunched
doesn't contain this so the OneSignal SDK can't get this value. You can set a break point or print out e.Arguments
to see that it WP8.1 isn't passing this.
不过,您可以通过将消息添加到附加数据"以及数据参数仍会传递给您的应用来解决此问题.
You can work around this however by adding your message to Additional Data as well as data parameters are still passed to your app.
这篇关于OneSignal 推送通知 ClickEvent 显示空值 Windows phone 8.1 C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:OneSignal 推送通知 ClickEvent 显示空值 Windows phone


- 使用 rss + c# 2022-01-01
- Windows 喜欢在 LINUX 中使用 MONO 进行服务开发? 2022-01-01
- 是否可以在 .Net 3.5 中进行通用控件? 2022-01-01
- 为什么 C# 中的堆栈大小正好是 1 MB? 2022-01-01
- Azure Active Directory 与 MVC,客户端和资源标识同一 2022-01-01
- CanBeNull和ReSharper-将其用于异步任务? 2022-01-01
- C# 通过连接字符串检索正确的 DbConnection 对象 2022-01-01
- 带问号的 nvarchar 列结果 2022-01-01
- 在 LINQ to SQL 中使用 contains() 2022-01-01
- 在 C# 中异步处理项目队列 2022-01-01