Using ActiveSync 4.5 with Visual Studio 2005 and the Emulator
After you have installed ActiveSync 4.5 and Visual Studio 2005 (and optionally the Windows Mobile 5.0 or Windows Mobile 6 SDKs) you will need to perform additional steps to use ActiveSync with the emulators. This FAQ covers how to setup ActiveSync, cradle the emulator and setup and manage the partnership. You will need to use ActiveSync if you want to test tcp/ip based applications on the emulator.
Setting up ActiveSync
First open ActiveSync and click on File – Connection Settings. You will see the screen below. Click the box on the “Allow connections to one of the following:” and select DMA in the drop down.
Even after you have setup ActiveSync you will have some additional steps to connect using ActiveSync. By default when you run a program for the Windows Mobile Device, you are prompted whether or not to use the emulator. Select the emulator and click deploy.
When the emulator is started, the device is not cradled. So ActiveSync does not see the emulator. This is true even though Visual Studio sees the device and transfers the program you are compiling.
To cradle the device, you will need to open the Device Emulator Manager. This is done in Visual Studio 2005 under Tools – Device Emulator Manager. You will see the screen below:
Scroll down in the list and you will see the emulator you chose based on the form size and the operating system. It has the green arrow to the right before the name. This means that the device is not cradled.
To cradle the device, right click on the emulator and choose the menu option Cradle. To uncradle right click on the emulator and choose the menu option to Uncradle. Also, you can uncradle and cradle the emulator as many times as you need to using the Device Emulator Manager.
The device in the Device Emulator will look as follows when it is cradled:
The Device Emulator Manager will continuously run until manually close it. To close it, right click on the icon in the tray and select Exit.
Setting up the Partnership
When you begin to cradle the device you will see the following. Keep in mind that the emulator does not support synchronization of Outlook items until Outlook has been setup initially.
Click ok and you will see ActiveSync begin to build the partnership:
If you click Cancel then your emulator is connected as a Guest. You will not be able to synchronize any items however you can copy files to the device.
The next screen is where you choose what items are synchronized. By default Favorites is checked. I suggest that you do not choose to synchronize any data unless your application requires it. Click next after you have selected the options you wish.
Then you will see the following screen:
Once you click Finish, ActiveSync will save the settings.
Then ActiveSync will show that the emulator is connected:
Be careful at this point! ActiveSync has a partnership with the emulator however the emulator state has not been saved. If you close the emulator and do not save the state you will see the following error. Then you will need to delete the partnership. Click Cancel and then uncradle the device and then delete the partnership.
After you have delete the partnership you will need to open ActiveSync and click on File – Connection Settings and uncheck the “Allow connections to one of the following:” and click OK. Then click on File – Connection Settings and check the “Allow connections to one of the following:” and click OK.
If you close the emulator you will have to delete the partnership. This can be done by using File – Delete Mobile Device and select the partnership name. Be careful not to delete any other partnership or you will have to setup a new partnership for that device.
Also, you cannot delete the partnership while it is in use or you will see the following error:
So when you exit out of the emulator, you are prompted whether or not to save the state of the emulator. Click on Yes. If you save the state and the device is cradled, it will be cradled automatically the next time you launch the emulator.
If you deleted the partnership in ActiveSync you will need to clear the state in the emulator. This is done after the emulator is opened and you click on File – Clear Saved State.
Using TCP/IP in the Emulator
By default ActiveSync with the emulator works differently than ActiveSync does with a device. When you use a real device, ActiveSync uses a new network connection (RNDIS for Windows Mobile 5.0/6 or PPP for prior devices) with an IP address on the PC and on the device to communicate between them. With the emulator, ActiveSync does not use a new network connection and it does not use an IP address on the device or the PC. Instead all requests to the internet are proxied to the IP address of the network adapter. So if you are using local services you will need to enter the IP address of the local adapter into the device in order to connect to these services. You can find the IP address on the PC by going to the command prompt (Start - Run - CMD) and typing IPCONFIG /ALL. The IP address will be the network address displayed.
If your problem is not resolved here, try Bev Howard's Solving ActiveSync Issues, the Microsoft ActiveSync Troubleshooter or Microsoft's Knowledge Base search on ActiveSync or Microsoft's Knowledge Base search on Mobile Information Server.