Just another Blog

My Technical, Professional and at times Personal Blog

Showing posts with label Windows 8 Charms. Show all posts

What are Windows 8 Contracts?

image

Contracts are the glue that bind Metro Style apps together with the system UI. Different Metro style apps can talk to each other if they have implemented the same contract. Basically, contracts provide Share, Search and Picker and other services to apps. Apps can implement one or more contracts to interact with the system in a fluid way.

Share Contract

image

Both Socialite and Tweet@rama have implemented Target Share Contract.

image

image

Share lets you share data from one app with any other app that has implemented a share contract. A Source app is the one which provides something to share. A Target app is the app being shared through. This data interchange is made possible through a set of common formats. Every app, where possible, should implement a Source share contract. Apps that produce or store content, news, information, data should implement a Source Share contract.

Apps such as Mail, Social Networks, Chat, Note Takers, Image Editors, Translator Apps etc should implement Target Share Contracts,

Search Contract

image

Search enables searching from anywhere within Windows 8 within your app. This is generally recommended than building a search within your app because the search functionality is standardized across all apps. The apps that show below the search box are all the apps that have implemented the search contract. So, the context of your search will change depending on your app. You don’t have to search app to app any more. With Search Contracts, you launch search from a single place across all apps.

Apps that browse or create dynamic content, then such apps will benefit from implementing search contracts.

Search is probably not useful for games/utility apps.

Picker Contract

image

image

Picker contract allows other apps to choose content (pictures, documents, media etc) from you app. If I wanted to change user tile, I can choose a picture from my desktop or any of the apps that have implemented the Picker Contract. Note the apps: Socialite, Photo Feedr, Shutter Web and Skydrive have implemented the Picker Contract.

image

image

I just grabbed a picture of mine from Socialite app.

Implement a picker contract, if your app:

  1. accesses or stores files that would be useful to other apps
  2. keeps data in a service (cloud, social network)

Summary

In summary, contracts enable apps to power Windows 8 experience. You need to implement the right contract for your app. Avoid creating redundant services that is already available in Contracts.

Google+ Followers