Random geekery since 2005.

Husband, father, programmer, speaker, writer, blogger, podcaster, collector, traveler, golfer.

Day1-EmulatorTools

This article is Day #1 in a series called 31 Days of Mango.

In Day#1, I thought it was important to note some awesome new additions that have been made to the Windows Phone Emulator, and how and when we can use them.  In short, we now have the ability to emulate Accelerometer and Location data in our apps.

Accelerometer Data Tool

In order to emulate Accelerometer data, you first need to write some code that taps into the Accelerometer.  Fortunately, Day #11 of the 31 Days of Windows Phone provides that exact example.

download

Once you’ve got it running, you should see an interface that looks like the image below.  To access the tools in the emulator, you need to click the arrow icon on the menu for the emulator:

image

When you click the arrows, you will bring up a second window where you can access the tools we’re interested in.

image

In order to feed accelerometer data into your application, all you need to do is click and drag the small red circle in the center of the screen.  It will rotate the image of the phone in 3D space, allowing you to pretend to shake, flip, or even spin the device.  Here’s another look at this tool, with the phone moved dramatically.

image

You can see that your application should be responding accordingly.  To reset the phone to its original position, or to choose a different standard position, you can use the Orientation drop-down in the bottom left corner.

image

Finally, if you want to emulate a random shaking motion, you can use the drop-down list on the bottom right, labeled “Recorded Data.”  For now, Shake is the only option available, but ultimately, you will be able to create your own recordings and replay them.

Location Data Tool

The second tab in the Windows Phone Emulator Tools is for location data.  In order to monitor your Location data, you can use the code from Day #13 of the 31 Days of Windows Phone

download

When you open that tab of the tools, you will see an interface that looks like this:

image

By default, the Location tool will always start centered on Microsoft’s headquarters.  In order to change your location on the map, you can zoom in or out using the buttons at the top of the screen, or pan and zoom on the map directly.  When you’ve found a location you’d like to use, simply click on the map to add a pushpin.

image

In fact, you can add as many pushpins as you’d like (there’s probably a limit, but I haven’t found it yet.)

image

What selecting a large number of locations allows you to do is emulate a walking or driving trip.  Imagine you’re building an application that shows you the nearest fast food restaurants.  By “pretending” to drive around town, you should be able to see your data in your application change as the locations change.  To feed this data into your application, unclick the “Live” button at the top of the Location tool, and press the “Play” arrow button next to the “Fire every 1 sec” text.

You can change the duration, but the tool will move from point to point (in order), emulating a drive.  If you accidentally add a pin to the map that was unintended, you can click the “X” next to any of the entries in the bottom left panel.

image

In the bottom right corner, you have the ability to Load previously recorded data.  If you look at the top the tool, on the menu, you can clear all of your points, or save a set of points to be loaded later.  This is where you can create individual sets of Location data to be used later during your testing.

image

This Location data tool should provide you with exactly what you need to create a compelling application that leverages lat/long data, whether it’s a jogging app, a social check-in style app, or even an app that provides driving directions.

The Screenshot Tool

The final tool you may have noticed in this Windows Phone Emulator add-on is the Screenshot tool.  This is designed to make it easy for you to take screenshots of your application.  This becomes especially important when you begin the process of submitting your application to the marketplace.  You must have at least one screenshot of your app in order to submit, and it has to be 800 x 480 pixels in size.  Instead of struggling with awkward screenshot tools that you may already be using, this tool will give you a perfectly sized screenshot of your application every time, regardless of the zoom level you use on the Emulator.

image

Unfortunately, it does not offer the ability to copy the image to your Windows Clipboard, but you can use the Save button to save it to a location on your machine.  I recommend creating eight different screenshots for every one of your apps.  You’re allowed to upload eight, so you should give your potential users as much visual information as you possibly can about what they are purchasing.

Summary

In short, the new tools in the Windows Phone Emulator are excellent for many purposes, but there are still many things your phone can do that these tools just don’t cover.  For example, some phones now have a gyroscope, and all of the phones have a Compass that we also can’t emulate.  Windows Phone 7.5 also brings us the advent of the Motion class, and we will cover that in detail later in this series.

For now, welcome to my next 31 Day adventure.  Tomorrow in Day #2, we’re going to cover DeviceStatus, which gives us a wealth of information about our user’s device, including power source, physical keyboard availability, and more.  See you then!

toolsbutton

Tags

14 responses to “31 Days of Mango | Day #1: The New Windows Phone Emulator Tools”

  1. Marinus Avatar
    Marinus

    The maximum number of pushpins is 99.

  2. […] trackbacks yet. 31 Days of Mango | Day #1: The New Windows Phone Emulator Tools » « M3…and why it’s called “M […]

  3. […] Der Originalartikel befindet sich hier: Day #1: The New Windows Phone Emulator Tools. […]

  4. Tinku Avatar
    Tinku

    Awesome article….thanks a ton…:)

  5. […] статьи 31 Days of Mango | Day #1: The New Windows Phone Emulator Tools Share this:Like this:НравитсяБудьте первым, кому понравился […]

  6. […] Англоязычная версия статьи доступна здесь. […]

  7. […] Este artículo es una traducción de Día 1: Las Nuevas Herramientas del Emulador de Windows Phone, … […]

  8. […] Jour #1: Présentation des nouveaux outils de l’émulateur Windows Phone […]

  9. Anders Avatar
    Anders

    It may be a stupid question, but isnt it important to include timestamps in the emulated location data if you want to calculate speed?

    1. jeffblankenburg Avatar
      jeffblankenburg

      There is actually a Speed value that is a part of every GeoCoordinate object that is returned, so you don’t need to calculate it.

      GeoCoordinate Class
      http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinate.aspx

      Speed Property
      http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinate.speed.aspx

  10. meg Tomlinson bishop Avatar
    meg Tomlinson bishop

    I need 1-4 and I don’t know how to download them when. I go to the download to windows phone button it takes me all the way to 31. what am I doing wrong? I have to be honest this whole touch phone is very new to me. Not to mention I was never the best when it came to computers.

  11. […] 没有合理使用模拟器工具:Windows Phone Mango SDK提供了对Emulator VM的多项增强,使用户能够更好地进行本地测试工作。只要这些工具能够为自己的应用程序服务,务必要让它们派上用场;点击此处了解关于模拟器工具的各项细则。 […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

%d bloggers like this: