Tuesday, May 20, 2014

When should you check that your app has the latest data?

This post was inspired by a question on Stack Overflow:

What a great question: When should you update data on the client to ensure that it's always up to date for the person using the app?


Unfortunately, there is no absolute answer to this question that will cover all scenarios for everybody.

It's easiest to handle this situation if price changes happen on a predictable basis, such as overnight or at certain times, and/or on certain days of the week.

If we know that prices only change at certain times of day (or week) we can limit unnecessary network traffic (and therefore delays in using the app) by just checking if we haven't checked since the last time that prices may have changed.

If building an app using Silverlight technologies (which will be the case if targeting 7.X, 8.0 & possibly 8.1) then you should check on app start up when either the Launching or Activated events are fired.
Of course the price may be changed while the app is in use. In this situation you could send a push notification to the app while it is running to tell it to update the data. You may also need to handle the situation where a purchase is attempted but such a notification hasn't been received or yet been acted upon. More on that below.
It is not possible to send a message to such an app when it is not running to have it automatically trigger getting the latest data.

If you want to check in the background (when the app is not running) then you'll need to use a Periodic Background Agent which can download the latest data ready for when the app is next used.


If building an app for Windows Phone 8.1 and using the new application framework (i.e. not Silverlight) then it is possible to trigger a background task to download the latest data from a notification message. You may also want to trigger checking on device starting in case any notifications were missed when the device was not on.
On app start-up you should check for the latest data after an activated or resuming event to check when navigating to (starting) the app.

With any of the above techniques, you can't be sure that the app will have received a message to notify it to update the data, or run the background task to check for the latest data or even been able to get to the server to get the latest data when the app is not running. This is why it makes sense to check on start-up in addition to any checking that is done in the background.

Ultimately, if the price can be changed at any time and the latest price must be used/honored, it will be necessary to check that the values which are being used on the client with the latest server prices and products when a purchase is actually made. (In reality you'll probably be checking this anyway to make sure that a product that is discontinued or out of stock is not being ordered.)
This should be in addition to any other work that is done to synchronize data at other times.


1 comment:

  1. 3 rd along with in the long run, your good quality in the Casio athletics fake rolex can be top-end. The idea survives significant instances as well as accessories are generally just for countless years. No-one will never have to have yet another enjoy for years. Many of the types have a very sun power battery pack. That will prolongs your designer watches extended life way too. Additionally, you will definitely always be happy by simply precisely how reasonably priced a new Casio athletics enjoy can be currently. Pertaining to fake rolex Rain forest gives some of them in savings involving 20% along with 50%! Your Garmin Precursor NAVIGATION designer watches are generally certainly, essentially the most innovative NAVIGATION athletics designer watches available. By simply backlinks to your multilevel involving satellites, your Precursor designer watches could properly evaluate rate, tempo, long distance along with increase earlier mentioned seashore amount. Garmin's exclusive tactic intertwines the facility involving NAVIGATION, using innovative along with fake rolex athletics enjoy capabilities that will permit you to evaluate along with taking athletics shows in the wise along with spontaneous means. Nevertheless what are resemblances relating to the six to eight Precursor designer watches available? plus much more prominently, what are variances? A pair of Ages involving Forerunners. To the uses on this iwc replica watches, many of us look at a pair of "generations" involving Precursor rolex replica sale. Your "older generation" involves style figures: information and facts, 201 along with 301, who have currently been recently replaced with the 205, 305 along with 405 types -- your "current generation".

    ReplyDelete