Writing Provisioning XML for Windows Mobile

This recent article discussed one of the ways you can use XML provisioning data – through a cab file installation. You can also pass the XML to DMProcessConfigXML or ConfigurationManager.ProcessConfiguration in the managed world. But how about creating the XML?


Well you could use notepad and code it all by hand as a worst-case-scenario. The next best thing is to use the XML support in Visual Studio which will at least help to ensure you write valid XML. Mobile In The Hand 2.0 takes this one step further by adding a schema into VS2005 to ensure your document conforms to the msprov schema:-


1. Create a new XML document in your project


2. With the document selected locate “Schemas” in the properties pane.



3. Click “…” to bring up a list of installed schemas



4. Select msprov from the list


5. Start writing your document and watch the intellisense kick in

Advertisements

No touch deployment with Pocket PC or “How I cancelled my dental appointment with Dr Johnson”

Earlier today I posted a link from the Windows Mobile Team blog on Pocket PC Thoughts on an article being produced to describe rolling out mobile devices to your enterprise. Here is some useful additional material with a more technical twist which didn’t seem appropriate to mix in with it.


This applies only to deploying Pocket PC devices in the field, and works easiest if you are rolling out a set of matching device models. The following sections are some techniques which have saved me time when deploying devices:-



  • When you first startup a Pocket PC device you are greeted by a Welcome Wizard. This is a perfectly legitimate starting point for a consumer who has just unpacked and charged their device, but is a real pain if you want to automatically deploy your software onto multiple devices.  To dismiss this wizard from appearing simply place an empty file called “welcome.not” in the root of a Storage Card.
  • No more rearranging dental appointments Great! well not quite, because this introduces two new issues – among the introductory material in the Wizard are two very important steps – Screen calibration and setting the Timezone. Both of these can be applied automatically by writing entries into the Registry or calling the appropriate APIs:-


  • Timezone is written as a binary array here:-



[HKEY_LOCAL_MACHINETime] “TimeZoneInformation”



  • The format of this is documented in the SDK – it’s a TIME_ZONE_INFORMATION structure. Assuming your batch of devices are all deployed to the same timezone you can copy the value from an existing device, or if you set the value on first run of your managed application you can make use of the DateTimeEx.SetTimeZoneInformation method in the SDF

 



  • Screen calibration is a little more interesting, as it will depend on the hardware. So although you can copy values from an existing device its probably better to run the screen calibration on the first run of your application. If you choose the “dangerous” route you’ll find the calibration settings in the string value here:-



[HKEY_LOCAL_MACHINEHARDWAREDEVICEMAPTOUCH] “CalibrationData”



  • Kicking off the standard screen calibration applet from your code is very easy – just P/Invoke TouchCalibrate which can be defined as



[DllImport(“coredll.dll”)]
private static extern bool TouchCalibrate();



  • This will launch the standard calibration screen and require the user to tap the centre and four points around the screen. It will return true on success and false if if fails.

For all of this to be automatic you will need an autorun.exe file located a folder matching the processor identifier of the device, so for any ARM based Pocket PC this would be 2577 on the storage card. While it is possible to write this application in managed code if your device has .NETCF in ROM, if you are catering for a range of devices you should write this file in native code. You can read more about this technique here and here.


Following this I am currently testing Spb Clone which allows you to create a clone image from a single unit and install it onto multiple devices, this supports either a self extracting exe installer or an autorun approach. I will post back a mini-review once I’ve done some more testing with it.