I've been working on some infrastructure for my contracting business. There are a lot of things that need to be tracked when you run your own business and for me it seemed that whenever I remembered something needed to be recorded I wasn't near a computer. However, I always have my mobile phone (Samsung Blackjack) near by and it made sense to me to write an application that allowed me to log things like time, mileage and the like from my phone.
Architecture
I could have gone the route of creating a web site for this purpose, but instead I decided to create a SmartPhone application that called web services on my server, at home. This way, if I ever decide to write a Windows Form or Web application front end, I can use the same web services and not have to recreate the logic they provide. The web service methods give me all the CRUD functionality I need to manipulate the data I'm storing, so all the UI code on the phone needed to do was collect data and call the web service for storage.
Writing the mobile application was very straight forward. I set a web reference to the web services I'd written and coded against the generated proxy. Getting used to the mobile controls and the bits of functionality not provided in the compact framework were the biggest challenges, but nothing major at all.
Lessons Learned
Getting an internet connection in the emulator
After I had written a bit of code, I was eager to see it run. I clicked the Start Debugging button on the Visual Studio toolbar and after prompting me for a target to deploy to (choose the emulator), an instance of the emulator was created and my code was deployed to it. When I tried exercising some code that made a web service call, a transport error was raised. I then tried to open pocket IE on the emulator and browse to an internet address, but got a message saying that I needed to configure my network settings on the phone. After some searching, I figured out how to set it all up. First, make sure you have ActiveSync installed and running. Then, right-click its tray icon and choose "Connection Settings" from the context menu. Make sure the check box for "Allow connections to one of the following:" is checked and select "DMA" in the combo box.
In Visual Studio, go to the Tools menu and select "Device Emulator Manager...". When the dialog opens, right-click the entry for "USA Windows Mobile 5.0 Smartphone R2 QVGA Emulator" and select "Connect". This will open an instance of the emulator. Next, right-click the same entry again and select "Cradle". At this point, ActiveSync should detect the emulator and treat it as it would a physical phone plugged into the USB port of the PC. Once you go through the connection wizard, you should have access to your PC's internet connection from the emulator through ActiveSync.
Deploying to the SmartPhone
Once my mobile application was unit tested, I was ready to deploy it to my phone. I connected the phone to the PC, right-clicked my mobile project in Visual Studio and selected "Deploy". The phone popped up up several dialogs asking me to approve the installation of several files on my phone. I approved all of these, but the deployment still failed. The reason stated indicated that there were some certs needed on my phone to deploy for development. To get past this error, copy the file ...\Program Files\Microsoft Visual Studio 9.0\SmartDevices\SDK\SDKTools\VSDCerts.cab to your phone. Then, on the phone, open the cab file to install the required certificates. The deployment should succeed after this is done. Of course, if you're developing an application for distribution, you'll want to properly sign your application instead of taking this short cut.