简体   繁体   English

确定通知启动Windows 8应用程序的时间

[英]Determine when a Windows 8 app is launched by Notification

I have notifications going to my application, I want to be able to take the user to that page in my application when they click on the notification or live tile (current displayed item). 我有通知进入我的应用程序,我希望能够在用户点击通知或实时图块(当前显示的项目)时将用户带到我的应用程序中的该页面。

Is there a way to determine what the tile data is when your app is launched from a Live Tile or Toast Notification? 从Live Tile或Toast Notification启动应用程序时,有没有办法确定平铺数据是什么?

Also, users have the ability to right click on a live tile and turn it off. 此外,用户还可以右键单击实时磁贴并将其关闭。 Is there a way to detect that so I can turn off sending them live tiles or does WNS handle that? 有没有办法检测到这一点,所以我可以关闭发送他们的实时瓷砖或WNS处理它?

Thanks! 谢谢!

Windows does not provide a way to determine the tile content when a user launches the app via a tile. 当用户通过磁贴启动应用时,Windows不提供确定磁贴内容的方法。 Per the UX guidelines launching from each of the following should have the corresponding behavior: 根据UX指南,从以下各项启动应具有相应的行为:

  • Main tile : The app should launch to the last place the user left the app or the app home page. 主要图块 :应用应该启动到用户离开应用或应用主页的最后位置。
  • Secondary tile : The app should launch to specific content in the app. 辅助磁贴 :应用应启动应用中的特定内容。
  • Toast : Like a secondary tile, the app should launch to specific content in the app. Toast :与辅助磁贴一样,应用应该启动应用中的特定内容。

All three of types of activation will cause the OnActivated event to be fired with the IActivatedEventArgs.Kind parameter set to ActivationKind.Launch . 所有三种类型的激活都将导致OnActivated事件被触发,并将IActivatedEventArgs.Kind参数设置为ActivationKind.Launch

For both secondary tile and toast activations, the app can provide an additional context in the LaunchActivatedEventArgs.Argument parameter. 对于辅助贴和Toast激活,应用程序可以在LaunchActivatedEventArgs.Argument参数中提供其他上下文。

For secondary tiles, the launch arguments parameter can be set upon creation of the tile via the SecondaryTile.Arguments property. 对于辅助切片,可以在通过SecondaryTile.Arguments属性创建切片时设置启动参数参数。

For toast notifications, the launch arguments parameter is set as an attribute in the toast notification XML: 对于Toast通知,launch arguments参数设置为Toast通知XML中的属性:

<toast launch="myLaunchContext">
    ...
</toast>

Lastly, apps should not need to check whether the tile has been turned on or off by the user. 最后,应用程序不需要检查用户是否已打开或关闭磁贴。 Windows and WNS will determine whether delivery is required. Windows和WNS将确定是否需要交付。 The user can turn the tile on/off while an app is not running, so the state saved by the app may be out of sync with the setting. 用户可以在应用未运行时打开/关闭磁贴,因此应用保存的状态可能与设置不同步。

you can detect the app lunch in App.xaml.cs 您可以在App.xaml.cs检测应用程序午餐

    protected override void OnActivated(IActivatedEventArgs args)
    {
        base.OnActivated(args);

        if(args.Kind == ActivationKind.Launch)
        {

        }
    }

Here is info on how to handle ToastNotification click event. 以下是有关如何处理ToastNotification点击事件的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 应用程序由于推送通知水龙头而启动 - App launched due to push notification tap Windows手机应用程序8.1 - 后台任务未启动 - Windows phone app 8.1 - Background Task is not launched 在Windows Phone 8.1应用中单击本地通知时,应用未打开? - App is not open when local notification click in windows phone 8.1 app? 从超级按钮栏启动Windows Store应用程序时崩溃。 否则效果很好 - windows store app crashes when launched from charm bar. works well otherwise 如何确定macOs应用是否通过URL启动 - How to determine whether the macOs app was launched via a url 检测iOS App是否由Unity中的本地通知启动 - Detecting whether iOS App was launched by a Local Notification in Unity 如何知道是否通过Android上的通知启动了应用/游戏? - How to know if app/game was launched via notification on Android? 应用程序在后台时在Windows Phone 8中播放音频通知 - Play audio notification in Windows phone 8 when app is in background Windows(phone)8.1应用程序处于前台时接收并处理通知参数 - Receive and handle a notification arguments when the Windows (phone) 8.1 app is on foreground 如何在启动应用程序时显示消息 - How to show a message when app is launched
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM