Reputation: 10567
I am writing a UWP app that expect to have updated data from a remote, say a cloud service or a remote station or whatever.
So, I thought an obvious solution would be to write a service that will sync data periodically and UWP app will just show it. I started reading about it and ended up reading this MSDN article about Windows 10 AppService
https://learn.microsoft.com/en-us/windows/uwp/launch-resume/how-to-create-and-consume-an-app-service
But after reading the article, I stumble upon this portion as per screenshot below which basically tells that if my app is back-grounded (minimized or covered by another app), then the service will continue running for up to 30 seconds and then stop running. This means after 30 seconds, my background syncing will stop:
How can I make sure that my data is being refreshed when needed even though my app is not in the foreground?
Upvotes: 3
Views: 843
Reputation: 2051
Your background task can only run for 30 seconds for processing information but you can make it so your background task runs ever 15 minutes to check if new information is available using a Time Trigger.
If you want your application to check more frequently you will have to use a Toast Notification that comes from a server, such as Azure Mobile App Service, AWS Simple Notification Service, etc. or you can create your own service using the WNS(windows notification service).
Azure https://azure.microsoft.com/en-us/services/app-service/mobile/
AWS https://aws.amazon.com/sns/
Upvotes: 1