Real email accounts inside the Windows Phone emulator
Join the DZone community and get the full member experience.Join For Free
In the previous version of the Windows Phone SDK one of the main problems was the fact that the email capabilities were directly removed from the OS, so the EmailComposeTask was useless without a physical device. With Mango, the situation changed and although there is no easy (let's say - direct) way to link the OS to a Live account (you cannot download Marketplace content without one), there is the possibility to have GMail and Yahoo Mail as fully functional accounts in the emulator.
Let's start with a simple code snippet:
PhoneCallTask task = new PhoneCallTask(); task.PhoneNumber = "000000000"; task.DisplayName = "User K. User"; task.Show();
Ultimately, I couldn't care less about the number and the name I am passing here. All I need is be able to access the People Hub. Once the task is activated and my application is sent to the background, I am faced with a fake call:
Next step is to add a person to a call, so I am clicking on Add Call and that's all I needed. Now I am able to click on the People button and navigate to the People Hub (otherwise locked in the OS):
Now a swipe to the left, and I am able to see the What's New panorama slide. Here is where it gets interesting. Even if the user is prompted with a message to add a Twitter or Facebook account, there is no way those can be added with the locked version of the emulator.
Initially, there is the Google option (for GMail):
Any Google account will do here, and once you enter the correct credentials, you will be able to access the connected inbox from the emulator.
So the next question - where exactly is Yahoo, since I mentioned it? It is hidden a bit deeper than this, and it is invoked directly from a system application. To be specific - from the built-in email client. Since GMail is already configured, open the client and expand the application bar:
Click on Add Email Account, and there you will see that now Yahoo appeared in the list of available providers. The reason Yahoo only appears here is because it is not integrated with the People hub and is only available to manage email.
You can set it up the same way as you set up the Google account, as long as you have the proper credentials. Congratulations! Now you have real email accounts set up and synced in the emulator!
Now, whenever I am using the EmailComposeTask:
EmailComposeTask task = new EmailComposeTask(); task.To = "firstname.lastname@example.org"; task.Subject = "Hello!"; task.Body = "Hello there!"; task.Show();
I will be prompted to select one of the existing accounts:
Opinions expressed by DZone contributors are their own.