Creating your own web browser for your SmartPhone

I like my Cingular 2125 SmartPhone (see Windows SmartPhone can run my Web Apps).

I went to Microsoft TechFest a couple weeks ago, which is put on by Microsoft Research to show off the latest and greatest. Several people had the same phone, and more than a couple indicated that this phone was a “keeper”. They had prior phones which have many features, but this phone is actually useful enough to be a “keeper”

Indeed, I’ve had it for around a month and I use it constantly, but very rarely as a phone!

Here are some features of it that I really like (Cingular 2125 review by PC Magazine)

  • It recharges whenever I plug it in to my laptop via USB cable
  • When it’s plugged in via USB, the web browsing/net connectivity of the host machine is used, so it’s much faster
  • When plugged in, I can use the host machine Windows Explorer to copy and manage files/shortcuts on the phone.
  • Its size: it’s so small that I can comfortably keep it in my pocket.
  • I was able to modify the Home page of the phone: it’s an XML file in Application Data\Home. I removed some of the advertising (get a new email account from Cingular!) and changed the order of the items.

I think it’s a misnomer to call it a phone. It’s

  • A radio transmitter/receiver
  • A digital still and movie camera
  • A network computer terminal
  • A programmable computing device with worldwide connectivity that’s always on and connected

There is only one Pocket IE instance at a time. So if I’m browsing, only one web page can be shown at a time. I have a simple Foxpro web application running on my web server which allows me to query my database of 23,000 photos. When I navigate to the web page using a web browser, it shows a textbox into which I can type a query string. Clicking “Query” causes the server to execute a SQL statement querying my photo database and send the results back. Thus I can query for “Microsoft Picnic” or “Hockey” to see my ice hockey team on my phone. (see Sharing Digital Pictures of your friend's ) I’ve customized the Fox app to detect the SmartPhone client and dynamically create an image of the exact resolution of the SmartPhone, minimizing data transfer and maximizing picture quality (see Create thumbnails of all your digital photos in a single table). It also rotates the landscape image 90 degrees because the phone display is portrait oriented.

This app runs fine in Pocket IE, except that if I navigate to another web page, I lose the pictures. I wanted to create a separate application from the Pocket IE so when I browse the web, my web picture application would still be running. Simple: create my own web browser! It took only a few minutes to get it working.

(You can do the following without a SmartPhone: VS comes with a SmartPhone emulator)

I started Visual Studio 2005, chose File->New project->Windows Mobile 5.0 SmartPhone

When I hit F5, I get a choice to run the app in an emulator or on the phone that’s connected via ActiveSync. It automatically installs the .Net Compact framework version 2.0 (see Project-> Properties->Devices, checkbox for “Deploy the latest version of the .Net Compact Framework”)

I had a problem: the installation of the .Net Compact Framework kept failing because I had not enough memory. I removed some programs (and reinstalled them to the Storage Card) to fix that

Drag a Web Browser Control onto your form.

In my Form Load event:

        Me.WindowState = FormWindowState.Maximized

        Me.WebBrowser1.Navigate(New System.Uri("https://<<url of my foxpro picture query application>>"))

See also another tutorial on getting started with the .Net Compact Framework

.

Problem: at first my app wouldn’t show as a running application in SmartPhone Task Manager. Therefore, there was no way for me to shut it down without rebooting the phone. When I tried to make the web browser control use the entire screen, I set the Form.Text property to the null string. When I changed that, it started showing in Task Manager.

Problem: using the SmartPhone Emulator, the date/time was off: I had to set the timezone: I’m not in England!