如何通过点击Toast通知打开我的应用程序时从Toast通知中获取数据?

问题描述:

如果用户点击一个吐司通知以打开我的应用程序,是有可能如何通过点击Toast通知打开我的应用程序时从Toast通知中获取数据?

  • 知道应用从Toast通知开的呢?
  • 从Toast通知中识别数据?

如果是这样,怎么样?

由于这里概述:http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh868212.aspx

创建敬酒,使其具有launch参数:

((XmlElement)toastNode).SetAttribute("launch", "{\"type\":\"toast\",\"param1\":\"12345\",\"param2\":\"67890\"}"); 

的吐司XML将出现

<toast launch="{&quot;type&quot;:&quot;toast&quot;:&quot;param1&quot;:&quot;12345&quot;:&quot;param2&quot;:&quot;67890&quot;}">       
    <visual> 
     <binding template="ToastImageAndText01"> 
      <image id="1" src="ms-appx:///images/redWide.png" alt="red graphic"/> 
      <text id="1">Hello World!</text> 
     </binding> 
    </visual> 
</toast> 

然后在应用程序的OnLaunched方法:

protected override void OnLaunched(LaunchActivatedEventArgs args) 
{ 
    string launchString = args.Arguments 

    .... 
}