Share via


Getting started with the SmartPhone emulator

Okay, so let’s pickup one of those “learnings” from my last post. How do I get started with the mobile device emulator in Visual Studio 2005. You can start the emulator from the Tools -> Connect to Device menu.

Select “SmartPhone 2003 SE Emulator” and up pops a nice rendition of a SmartPhone. Visual Studio will automatically prompt you for the relevant emulator when you start debugging your application. The trick though is getting network connectivity to work. For this you need ActiveSync (the latest version is 4.2, I’m using version 4.1). Install ActiveSync, open the ActiveSync application and select “File -> Connection Settings…”

Ensure that “Allow connections to one of the following:” is checked and the drop-down is set to DMA. With me so far? Now start the “Device Emulator Manager” in Visual Studio (“Tools -> Device Emulator Manager…”). If the emulator is not running, start it now by right clicking on the relevant entry in the emulator manager and selecting “Connect”. Now, with the emulator running, right click the entry again in the emulator manager and select “Cradle”. You can just opt for a guest partnership. This should establish an ActiveSync connection and you should now be able to browse the network from the mobile device emulator using a pass-thru connection…

Where I ran into a few problems was trying to connect to web services hosted locally on my PC vs web services hosted remotely. Firstly, make sure you don’t use “localhost” in the URL for services hosted locally on your PC – use your machine name or IP address as “localhost” means nothing to the mobile device. Secondly, you may need to change the “This computer is connected to:” drop down in ActiveSync to get it to connect. If your web service call fails with a System.Net.WebException with a Status = “ConnectFailure” then try toggling the setting in that drop down and trying again.