Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Windows Phone中以Toast或Tile通知的形式在负载中发送Json数据_Json_Push Notification_Windows Phone 7.1_Mpns - Fatal编程技术网

如何在Windows Phone中以Toast或Tile通知的形式在负载中发送Json数据

如何在Windows Phone中以Toast或Tile通知的形式在负载中发送Json数据,json,push-notification,windows-phone-7.1,mpns,Json,Push Notification,Windows Phone 7.1,Mpns,我想在Windows Phone中以Toast或Tile通知的形式在负载中发送Json数据,如下所示: string msg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<wp:Notification xmlns:wp=\"WPNotification\">" + "<wp:Toast>" + "<wp:Text1><string>&l

我想在Windows Phone中以Toast或Tile通知的形式在负载中发送Json数据,如下所示:

string msg =
    "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
    "<wp:Notification xmlns:wp=\"WPNotification\">" +
       "<wp:Toast>" +
       "<wp:Text1><string></ltwp:Text1>" +
       "<wp:Text2><string></wp:Text2>" +
       "<wp:Json><data></wp:Json>" +
       "</ltwp:Toast>" +
    "</wp:Notification>";
string消息=
"" +
"" +
"" +
"" +
"" +
"" +
"" +
"";

如果可能的话,我是否能够在ShellToastNotificationReceived事件处理程序中接收Json?

如果您想发送通用内容,应该使用。这可以包含您想要的任何内容

原始通知的限制是,如果您的应用程序未运行,则无法接收原始通知,因此您可能希望向设备发送Toast(或tile)通知,然后在随后启动应用程序时触发原始通知的发送。

当然,如果您正在发出web请求以触发发送单个原始消息,则最好只发送有效负载以响应触发请求。

如果您希望发送通用内容,则应使用。这可以包含您想要的任何内容

原始通知的限制是,如果您的应用程序未运行,则无法接收原始通知,因此您可能希望向设备发送Toast(或tile)通知,然后在随后启动应用程序时触发原始通知的发送。

当然,如果您发出web请求以触发发送单个原始消息,则最好只发送有效负载以响应触发请求。

您可以发送具有以下值的参数:

string msg =
  "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
  "<wp:Notification xmlns:wp=\"WPNotification\">" +
  "<wp:Toast>" +
  "<wp:Text1><string></ltwp:Text1>" +
  "<wp:Text2><string></wp:Text2>" +
  "<wp:Param>/Home.xaml?NavigatedFrom=Toast Notification</wp:Param>" +
  "</ltwp:Toast>" +
  "</wp:Notification>";`
string消息=
"" +
"" +
"" +
"" +
"" +
“/Home.xaml?NavigatedFrom=Toast通知”+
"" +
"";`
  • 如果您的应用程序正在前台运行,则
    PushChannel\u ShellToastNotificationReceived(object sender,NotificationEventArgs e)
    将被触发,并在
    e.Collection[key]
    中找到您发送的消息
  • 如果您的应用程序未在前台运行,则点击toast notification应用程序将启动并导航到指定页面(此处
    /Home.xaml
    )。在页面的
    OnNavigatedTo(NavigationEventArgs e)
    事件中,您可以找到传递的参数并使用它们
因此,您可以通过在参数值中发送json字符串来尝试,并可以在应用程序中使用它们。我没有尝试过。此信息可能对您有用


祝您一切顺利。

您可以发送具有以下值的参数:

string msg =
  "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
  "<wp:Notification xmlns:wp=\"WPNotification\">" +
  "<wp:Toast>" +
  "<wp:Text1><string></ltwp:Text1>" +
  "<wp:Text2><string></wp:Text2>" +
  "<wp:Param>/Home.xaml?NavigatedFrom=Toast Notification</wp:Param>" +
  "</ltwp:Toast>" +
  "</wp:Notification>";`
string消息=
"" +
"" +
"" +
"" +
"" +
“/Home.xaml?NavigatedFrom=Toast通知”+
"" +
"";`
  • 如果您的应用程序正在前台运行,则
    PushChannel\u ShellToastNotificationReceived(object sender,NotificationEventArgs e)
    将被触发,并在
    e.Collection[key]
    中找到您发送的消息
  • 如果您的应用程序未在前台运行,则点击toast notification应用程序将启动并导航到指定页面(此处
    /Home.xaml
    )。在页面的
    OnNavigatedTo(NavigationEventArgs e)
    事件中,您可以找到传递的参数并使用它们
因此,您可以通过在参数值中发送json字符串来尝试,并可以在应用程序中使用它们。我没有尝试过。此信息可能对您有用


一切顺利。

因此无法在Toast notification msg中发送自定义数据?@Vivek您可以发送它,但它必须位于定义的字段/属性之一,因此它将显示给用户并受长度限制。无法在toast或tile消息中发送其他/自定义信息。感谢您的回答。如果你能回答的话,我还有一个小问题。如果我放弃通知并手动启动应用程序,我还会在事件处理程序中收到通知吗?@Vivek我不这样认为,但请尝试并检查它。因此,无法在Toast notification msg中发送自定义数据?@Vivek您可以发送它,但它必须位于定义的字段/属性之一,因此它将显示给用户,并受长度限制。无法在toast或tile消息中发送其他/自定义信息。感谢您的回答。如果你能回答的话,我还有一个小问题。如果我放弃通知并手动启动应用程序,我还会在事件处理程序中收到通知吗?@Vivek我不这么认为,但请尝试并检查