0
votes

In my windows phone 8 application, I would like to refresh/load some data periodically (less than 10 minutes) from server, while application running in background (ie, in dormant and tombstoned). I tried scheduled task agent and resource intensive task agent, but they are called at rate of 30 minutes gap. Please let me know is there any other solution for implementing the above said requirement.

Thanks and Regards @nish

2
The application is not running in a background. so you can't make any api request. The only possible options are: BackgroundAgent (but it's a unstable solution) and push notifications.Anton Sizikov
Why is every ~30 min not enough?Shawn Kendrot

2 Answers

0
votes

Do I understand correctly that your primary goal is to keep some host session alive by having the phone make a query periodically? If so...

I would not recommend this approach: 1) you cannot count on the phone having network connectivity when it tries to send its query. If the user puts the phone away in a pocket or purse, the odds worsen. 2) it's probably bad from a security perspective, and wasteful from a host resources perspective.

You might instead add logic to your app to resume a timed-out host session as seamlessly as possible. This would add real utility value to the mobile app value proposition over raw HTTP access to the same host.

1
votes

If you need to get data more frequently than the default available in Windows Phone, you should think about using push notifications. This won't be suitable for a full data push, but if you use it correctly, you can get a user experience that you can live with.

One common approach to this is to set up your server to send a notification to the device when there is something new to report instead of pushing a "nothing has changed" message every 10 minutes or so. If you push out a tile update notification to say, for example, "You have x unread items", the user may then click on the tile for your app and you can poll the server for new items on launch/resume. If you want a more intrusive option, you can send a toast notification as well, but in most cases the tile update will be sufficient.

This method has a few advantages.

  1. You won't be burning through battery power polling every 10 minutes while the user is asleep
  2. Your server will have significantly less load since it is not having to process full data requests every 10 minutes per client.
  3. This fits in with the design philosophy of Phone apps - you are surfacing the required data to the user, while at the same time preserving battery life.