Bandwidth friendly data access in WP7 app

Recently, I heard lot of fuss about too much bandwidth usage by some Windows Phone 7 devices and Microsoft has blamed some third party applications. I don’t know the exact and real reason. But, there can be different ways to minimize the data usage. And I’m not going to talk about ‘turning off data connection’ :)

Most of the time, we (application developers) need to access data from remote locations. And this can add to data usage. For this reason, I found JSON very helpful. One way to reduce this usage is by opting for JSON. Well, there are some good reasons for it. Both XML & JSON has their own pros and cons. And many veterans has mentioned about it.

Now, if you’ve got XML Web Services, then its pretty easy to work with them on WP7 platform, just like any other Silverlight application consuming XML Web Services.

However, when it comes to JSON, there are different options & tools available:

  • DataContractJsonSerializer
    This class is available for JSON serialization and deserialization, which is available within base class library
  • Json.NET
    The above library is good for normal JSON de/serialization. However, as mentioned over here, Json.NET is open source library, which is much more easier and powerful (in terms of performance considering large amount of JSON data)
  • JSON Class Generator
    The best part with XML Web Services or WCF Services is: there are tools which allows you to generate proxy classes for easy access to types at client side (remember svcutil.exe?). It would have been really great if Microsoft has provided one utility to generate classes from JSON. Not to worry though. This utility does the same thing for you. 

Now, as a Mobile Application Developer, consuming less bandwidth is one of our challenge. And JSON can help us with it (with adding some more challenges). However, you need to think of the problem and choose between XML services or JSON services, whichever fits the bill.

Namaste

Mayur Tendulkar | www.mayurtendulkar.com

Published by

Mayur Tendulkar

Struggling Juggler at Dyte

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.