Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
455 views
in Technique[技术] by (71.8m points)

uwp - BackGround Task to trigger if any changes in the Action Center

I need to trigger my background task when the application added the toast notification to the action center. I have tried with ToastNotificationHistoryChangedTrigger and it's not triggering the task when the application added the toast notification. Is there any solution for it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

ToastNotificationHistoryChangedTrigger is fired whenever the collection of toast notification history from your app changes on the device. Subscribing this trigger, will allow your app to get notified when:

  • A toast notification is removed by the user from action center;
  • A toast notification is expired and removed by the system from action center;
  • A toast notification is delivered form your app, via push;

Note: the only thing your app wouldn’t be notified for, is a local toast being popped/added, since it is not necessary to notify your app client about something it just did.

So generally, an app can be notified with ToastNotificationHistoryChangedTrigger when the app’s collection of notifications is changed in any way that’s not caused by the app’s local client. If your application added the toast notification by itself, the trigger won't be fired.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...