[UWP]关于NotificationListener的几个问题 [英] [UWP]Couple of questions regarding NotificationListener

查看:84
本文介绍了[UWP]关于NotificationListener的几个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,

我正在开发一个可以接收任何Toast通知的应用程序。 本文档https://blogs.msdn.microsoft.com/tiles_and_toasts / 2016/05/26 / notification-listener-documentation-windows-10 /给我指明方向。关于Windows 10中的新功能
,我有几个问题:

I am currently developing an app which can receive any toast notifications. This document https://blogs.msdn.microsoft.com/tiles_and_toasts/2016/05/26/notification-listener-documentation-windows-10/ gives me the direction. Regarding the new feature in Windows 10, I have couple of questions:

1。如果我只关心新添加的toast通知,而不是比较delta,还有其他替代方法吗?

1. If I just care about the new added toast notifications, instead of comparing the delta, is there any other alternative ways?

2。是否可以将此UWP样本转换为桌面应用程序,因为我们不希望涉及任何UI?

2. Is it possible to convert this UWP sample to desktop application since we don't want any UI involved?

>有一个函数Application.OnBackgroundActivated接收通知回调,因为桌面不支持Application类,如何从桌面应用程序调用它?

> There is a function Application.OnBackgroundActivated which receives the notification callbacks, since Application class is not supported in desktop, how to call this from a desktop app?

>对于其他类,如BackgroundTaskBuilder,BackgroundTaskRegistration等,它们未在下面列出

> for other classes like BackgroundTaskBuilder, BackgroundTaskRegistration etc , they are not listed below

    https://msdn.microsoft.com/en-us/library/windows/desktop/dn554295(v=vs.85).aspx,可以从桌面应用程序调用它们吗?

    https://msdn.microsoft.com/en-us/library/windows/desktop/dn554295(v=vs.85).aspx, Can they be called from desktop app?

3。如果第二个问题的答案是不可能的,有没有其他方法可以实现我的要求:桌面应用程序可以接收任何新的即将到来的通知。怎么做?

3. If the answer to the second one is impossible, Is there any alternative method to achieve my requirement: a desktop app which can receive any new coming toast notifications. how to do this?

谢谢,

Serena

推荐答案

Serena Wong,

Hi Serena Wong,

>>如果我只关心新添加的toast通知,而不是比较delta,还有其他替代方法吗?

>>If I just care about the new added toast notifications, instead of comparing the delta, is there any other alternative ways?

似乎没有别的方法,我们必须计算之间的差值我们当前的通知集合以及平台中的通知。

It seem there is no other way, we have to calculate the delta between our current notification collection, and the notifications in the platform.

>>是否可以将此UWP示例转换为桌面应用程序,因为我们不想要涉及的任何UI?

>>Is it possible to convert this UWP sample to desktop application since we don't want any UI involved?

不,它不是。我们无法将UWP应用程序转换为桌面应用程序。

No, it is not. We can not conver the UWP app to desktop application.

>>如果第二个问题的答案是不可能的,有没有其他方法可以实现我的要求:一个桌面应用程序,可以接收任何新的即将到来的通知。怎么做?

>>If the answer to the second one is impossible, Is there any alternative method to achieve my requirement: a desktop app which can receive any new coming toast notifications. how to do this?

我们可以使用Desktop Converter将桌面应用程序转换为UWP应用程序,之后我们可以在里面使用toast相关的API桌面应用。

We can convert the desktop app to the UWP app by using the Desktop Converter, after that we can use the toast related API inside the desktop app.

添加UWP功能。按照您自己的节奏,您可以将UWP功能添加到您的应用程序包中,例如XAML用户界面,实时磁贴更新,UWP后台任务,应用程序服务等等。

有一个文档关于使用桌面桥将您的桌面应用程序带到通用Windows平台(UWP),请通过以下链接参考:  https://msdn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-root

There is a document about Bring your desktop app to the Universal Windows Platform (UWP) with the Desktop Bridge, please refer it in this link: https://msdn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-root.

最好的问候,

Jayden Gu

Jayden Gu


这篇关于[UWP]关于NotificationListener的几个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆