Roamin’ Umpire

When a mobile system requires a data connection in the field you accept incurring a certain cost to establish a GPRS connection. You may be lucky enough to have an unlimited plan or you may be billed based on the volume of data you use. Either way reducing the amount of data you send and receive is valuable as it will reduce the time taken to synchronise data improving the user experience and reducing load on your servers.

However have you considered what happens when you take the device out of your home network? Roaming data charges can vary from high to extortionate and you probably won’t have the luxury of a flat usage plan. In fact in a lot of cases you might want to restrict the application when used outside of the normal operating network – either to stop all data communications or to limit them to a minimum and perhaps only synchronise when the user manually initiates it rather than on a regular schedule. If you look at a couple of synchronisation applications – ActiveSync or Live Mesh for example these have a checkbox option to disable a synchronisation schedule when the device is roaming on a foreign network – the user has to actively change this before the device will automatically connect and synchronise data. This can be quite a good model to follow in your own applications. You may alternatively decide to set this behaviour based on a central policy rather than letting the user choose.

In order to react to changes in the network you can use the State and Notifications Broker which exposes a property with the current roaming status – SystemState.PhoneRoaming which is a boolean property. Because you can trap this event you can react as soon as the device registers on a foreign network or when it returns home and customise your code accordingly. Unfortunately not all applications are this considerate – Microsoft’s MyPhone client will continue to sync automatically unless you disable scheduled synchronisation while roaming – the opposite behaviour to their other applications. Let’s hope this is tweaked in a software update to help avoid nasty surprises!

By Peter Foot

Microsoft Windows Development MVP