software you can take with you

Peter Foot

Microsoft Windows Phone Development MVP

Windows Mobile Provisioning using Mobile In The Hand 4.0

In the last post we saw the new My Extensions template which adds access to new Visual Basic features. In this post we will look at another new item introduced with Mobile In The Hand 4.0 - Provisioning XML. Visual Studio has a rich XML Editor built in, Windows Mobile uses provisioning XML documents for everything from adding a browser favourite through to configuring a new GPRS network. The new template allows you to quickly create an empty Provisioning XML document and includes the schema to ensure your document is valid. Let Visual Studio's Intellisense help you quickly build a provisioning document.

As with the Visual Basic example you start with an existing device project, in this case it can be either C# or Visual Basic. Select Add New Item and choose Provisioning XML from the list:-

In this example I have called the file AddFavourite.xml (no prizes for guessing what task we will be performing). The document is created with a skeleton provisioning document. Notice the namespace is provided which links to the schema we installed for you.

You can now add the required code between the wap-provisioningdoc tags. As you start to type the IntelliSense will suggest valid elements for you based on the schema:-

 

This makes it very easy to quickly build up a complete document:-

You can process a configuration document like this using the ConfigurationManager class. By setting the document as an embedded resource you can use the following code to load it and pass it to the ConfigurationManager:-

 

Dim xd As New System.Xml.XmlDocument

xd.Load(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualBasicDeviceProject.AddFavourite.xml"))

InTheHand.WindowsMobile.Configuration.ConfigurationManager.ProcessConfiguration(xd, False)

After running this code you can check your Internet Explorer Mobile favourites:-

For more information about the library see the product page.

Comments

No Comments

About PeterFoot

Peter Foot is co-author of the Microsoft Mobile Development Handbook published by Microsoft Press. Peter has been awarded the Microsoft Most Valuable Professional (MVP) accolade since 2003 for his involvement in the Microsoft .NET Compact Framework developer community. Alongside an active presence in several online forums and communities, attendance at developer conferences and involvement in shared-source projects, Peter has also written a number of technical articles and maintains an active technical blog.
Copyright © 2001-2013 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy. OrcsWeb's Windows Cloud Server Hosting