11 - Building Connected Windows Apps

Building Connected Apps in Window store development

In today’s scenario, people are connected using devices; those are connected to a network. In windows store apps, we can also apply the same feature as well. While building connected apps, some issues can be arise like network connectivity, network cost or performance cost etc.

While building connected apps, we should keep some points in mind:

  • API should be chosen accurately

While developing window store app, we have to use the right networking API, so that we can communicate with other computers and devices over the network. Like in gaming apps, we can connect with a website to update score and user information.

Windows 8 provides several APIs to access web services and web sites.

One more example of windows API is downloading and uploading photos in photo app.

  • Appropriate network capabilities

Network capabilities are useful in sense to protect from other users and apps. In windows store apps we can’t use networking as an inter process communication between a window store app and a desktop app on the same device that means we can’t use loopback address in a window store app.

In window store apps basically network can be accessed in two ways:

Outbound: it is client initiated request. The app can send one or more requests to server, then server reverts a single response or several responses.

  • App behaviour should be adapted accurately

Adapting app behaviour for metered network

In today’s scenario the mobile network connections are increasing day by day, so it the problem for users that when they either exceed the data uses or roam in different monetary charges can be applied. So it is mandatory that apps should monitor available network resources and respond accordingly.

For the same many possible connection costs are defined by

Windows.Networking.Connectivity.ConncetionCost such as:

   NetworkCostType
   OverDataLimit
   Roaming
   ApproachingDataLimit

Every app those are used to transfer large amount of data, should determine the bandwidth that should be used and the cost of information about the network, on which it can send and receive data depending on the limitation set by the Data provider.

  • Reacting to network status changes

In mobile apps, it’s very common thing that network availability changes frequently. Like a user when leaves his home Wi-Fi network won’t be available and 3G network can be out of range when he enters in shopping mall or home. While user enters into range of different networks, new connectivity option will be available for the app. In every case an app needs to be involved.

 

Every window store app that uses a network indicates an error if connection is lost. It also checks the cost of connecting to the internet. It also shows the Retry operation.

It registers for network status change notifications.

Windows Runtime makes all the basic information on the status of the current connection accessible through a static class called NetworkInformation. This class is available in Windows.Networking.Connectivity namespace.

By subscribing the object of NetworkStatusChanged class, we can get automatic updates when network connectivity changes. We can get the current network information by querying the current network’s profile by calling the GetInternetConnectionProfile method on the same class. This will return with a ConnectionProfile object. I f there is no active connection the return value will be null.

Accessing Windows Live

It is a service that identifies the public online services and web based applications the company freely provides to everyone. Like e-mail, instant messaging, file storage, synchronization and sharing (Sky drive) and scheduling (Calendar).

All applications are connected to each other.

When we start Windows 8 with Microsoft account, the operating system connects us to these services immediately.  Enhancing apps using Windows live integration starts with downloading the live SDK of the Live SDK dynamic link library to our app.

After that we have to register our app to the windows live, we must specify which parts of the user’s data the app wants to use, when the user starts the app for the first time, and connects to windows live, windows live confirms that the app can access the resources it wants to use, if user agrees, there will be no further sign-ins or confirmations needed.

Like us on Facebook