Emulating Location Information
When using the emulator, you can emulate
location (for example, A-GPS) information for your application for
testing. To accomplish this, you need to open the Additional Tools
sidebar of the emulator , as shown in Figure 2.
FIGURE 2 Opening the emulator’s Additional Tools sidebar
The Additional Tools dialog box includes two tabs. For location information, you’ll need to click the Location tab, as shown in Figure 3.
FIGURE 3 Selecting the Location tab
The Location section of
the Additional Tools dialog box includes several pieces of key
functionality. You can see the basic layout of the location user
interface in Figure 4.
FIGURE 4 Location tab of the Additional Tools dialog box
The main part of the window (labeled #1) is the
map. You can scroll around and double-click/scroll-wheel to zoom on the
map. In the upper-left corner of the window is a search box (#2) to
enable you to find a location on the map. Typing in a name, ZIP Code,
or other description will focus it on the map. Next to the search box
are zoom tools to help you find the right level of detail. Next, the
Live button (#3) is a toggle to enable live mode. In this mode, the
emulator will use the center of the map as the current location for the
phone.
Finally, you can also
specify map pins if the pin button (#4) is selected. This way, you can
create routes (the pins are sequentially numbered as you click them) so
that you can see what happens as you are simulating a set of locations.
With the pin button pressed, every time you click the map it creates a
waypoint, as shown in Figure 5.
FIGURE 5 Using pins to create waypoints
If you unselect Live,
you’ll be able to press the play key in the upper-right corner to
actually play through the set of waypoints. You should notice that the
lower-left corner of the dialog box shows you all the waypoints and
allows you to reorder and delete individual waypoints. You can also
clear all the waypoints by clicking the “delete all points” button to
the right of the pin button.
Finally, you can take your waypoints and timings and save them for replay. To do this, click the save button shown in Figure 6.
FIGURE 6 Saving recorded data
You can reload saved data by using the
Load button in the lower-right part of the dialog box. This way you can
create complex location information and use it to test your
application. By using these features you can simulate location
information in the emulator and enable testing scenarios that would be
impossible in real life.