Download Article
Delivering a Better User Experience for Windows* 8 Applications - Data Caching and Content Syncing[PDF 242KB]
Introduction
Windows* 8 New User Interface favors applications that quickly and persistently provide the latest information to users using “Live Tiles”. Live Tiles are regularly updated with a quick hit of the latest information, whether it’s the number of new emails received, recent postings from friends, trending news articles, stock prices, etc. If a user wants more detail, read new emails or learn more about a news story, he or she opens the Live Tile or moves back to the application if previously open. At this point, the majority of applications go back out to the cloud to pull down the full content that the Live Tile was summarizing. This is fine if you have an active network connection, but what about notebooks that have intermittent connectivity (e.g. WiFi only)? This can create a jarring user experience. First, if the user has no network connection when attempting to view the details, he or she will either get an error message that there is no internet access, or the user will see detail that doesn’t match the Live Tile. Either approach results in a poor, unexpected experience and a dissatisfied user. Architecting your application to mitigate this experience has multiple benefits:
- Users will experience a quicker response to getting data than waiting for the application to retrieve everything from the cloud.
- Content will be available regardless of connectivity.
- Applications that proactively address these two scenarios will differentiate themselves on systems that have either Connected Standby or Intel® Smart Connect Technology by providing the latest information when the user returns to the PC. Both of these technologies allow applications to update content while the system is in standby.
Resolution
The “no internet” error message problem can be addressed by developers designing and building their applications to cache data for offline use. This allows the user to go back and see information regardless of their connectivity – previously viewed emails, yesterday’s news articles, a friend’s last picture post, etc. The stale data problem can be resolved by integrating background tasks that Windows* 8 already provides to create a direct correlation between what the Live Tile is communicating and the detailed information in the application. A side benefit is that the user will perceive quicker access to the already fetched data as compared to waiting for the information to be retrieved on demand. This article will help developers tackle both of these problems as well as provide sample code to help illustrate the solution.
Designing an application with this in mind helps improve the user experience for systems with intermittent connectivity (e.g. WiFi only) and systems that support Connected Standby or Intel® Smart Connect Technology.
Target Applications
In general, these capabilities are most useful for applications that get regular updates from an internet or cloud service. Some examples of applications that would benefit are email, social media (Facebook*, Twitter*, Pintrest*, etc.), news outlets, magazine subscriptions, stock tickers, etc.
Caching Data
As mentioned previously, being able to access information from an application even when it is offline provides a better user experience. Microsoft has written an excellent article that highlights the four key HTML5 features that allow developers to create a good offline application experience for Windows 8 New User Interface. The four features are:
- AppCache to store file resources locally and access them offline as URLs
- IndexedDB to store structured data locally so you can access and query it
- DOM Storage to store small amounts of text information locally
- Offline events to detect if you’re connected to the networ
You can find this detailed article on MSDN: Building Offline Experiences with HTML5 AppCache and IndexedDB.
In addition to the HTML5 data storage techniques described above, Microsoft has provided other application data storage mechanisms for Windows 8. These mechanisms allow a user to easily manage everything from simple state information to large amounts of content. The data may also be designated as temporary, local or roaming, turning the management of persistence and synchronization between devices over to the operating system. An excellent article on these concepts is on MSDN: Accessing app data with the Windows Runtime (Windows Store apps).
Synchronizing Application Data Periodically
An application will typically update with relevant content as the user interacts with it, but developers should also consider all the cases in which the application should update when it is not in the foreground or even when the system is not powered on. These cases may include:
- When a push notification is received and reflected on the Live Tile
- After an appropriate amount of time has passed since the last synchronization
- When internet access becomes available after a period of time
An application can subscribe to these events to trigger synchronization. These are called background tasks and they were introduced in Windows 8 for application developers to allow for things like content updates. A background task is a separate executable that is allowed to run, even in Connected Standby or when the application is suspended, when triggers associated with it occur.
Background tasks are designed and bundled with the core application. The triggers associated with each background task must be defined in the code and all necessary capabilities must be declared in the application manifest. A great overview that covers triggers and manifest information is “Guidelines for Background Tasks” on MSDN. (http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh977051)
For more details on application manifest refer to “How to Declare Background Tasks in the Application Manifest” on MSDN. (http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh977049) In order to accommodate a wide variety of systems with varying capabilities and configurations, a combination of triggers may be most appropriate.
To provide the most up to date and responsive experience, a system may either have Connected Standby or Intel® Smart Connect Technology but not both. Some systems may have neither. Each case will benefit from slightly different triggers but they can be used together to cover most cases. For example, a system in Connected Standby will maintain Internet connectivity when available so a timer trigger may be most appropriate. On the other hand, a sleeping system with Intel® Smart Connect Technology will wake periodically and should only check for new content if the Internet is available. And for any PC, triggering on internet availability along with a timer will ensure that the data is synchronized and the internet connection is leveraged within the Windows 8 framework.
Conclusion
The new user interface that arrived with Windows 8 is a great vehicle for application developers to deliver new experiences. These experiences can be even richer for applications that periodically refresh content from the cloud. Developers who have applications that fit this theme are encouraged to look at incorporating background tasks for more frequent synchronization and data caching into their design to improve users experience on Windows 8.
About the Authors
Josh Moss is a Product Marketing Engineer at Intel and works on Intel® Smart Connect Technology.
Tom Propst is an Applications Engineer at Intel enabling enterprise software.