Using DDMS to update location

We talked a lot about DDMS (the Dalvik Debug Monitor Service) in Chapter 5, but two features are related to location updates. The Emulator Control pane of the DDMS screen provides several ways of controlling the running emulator. After switching to the DDMS perspective (click on DDMS in the upper right of the Eclipse window), you should see the Emulator Control pane in the middle left of the DDMS window (Figure 9-1). You will probably have to scroll down in that pane to see the controls related to Location Controls.

Emulator Control g

A

Location Controls

Manual [ GPX ;i KML |

©Decimal

O Sexagesimal

Longitude | 0

Latitude \ o|

[Send |

1

Figure 9-1. DDMS Emulator Control pane

To send a one-time update of a location to the emulator, just enter the longitude and latitude in the appropriate boxes and click Send.

If you click on the GPX or KML tabs, you will be able to load a GPX or KML file that describes a path, as shown in Figure 9-2. Here we've already loaded the file OR.kml, which is included on the website for this book. It traces a path near O'Reilly headquarters in Sebastopol, California.

You can create GPX tracks with many GPS navigation software tools, and KML tracks with Google Earth or many other navigation programs. The OR.kml file was generated

|p Emulator Control E3

D

Location Controls

■d

Manual j[ GPX

j KML

[Load KML... |

Name

Longitude

Latitude

Eleva.,

A

OR1

-122.823928

38.402731

0.0

QR2

-122,806449

38,407869

0,0

OR3

-122.791108

38,415008

0,0

■Li

OR4

-122,778163

38,422142

0,0

0R5

-122,767356

38,428 5 20

0,0

ORS

-122,752762

38,430001

0,0

0R7

-122,736483

33,433165

0,0

ORS

-122.715343

38.431800

0.0

r-inn

inn iiccnn

rjo j^onm

n n

3

Figure 9-2. DDMS Emulator with KML location updates by plotting a series of Google Earth Placemarks and concatenating them together into a single file. Here's an excerpt from OR.kml:

<?xml version="1.0" encoding="UTF-8"?>

<kml xmlns="http://earth.google.com/kml/2.2">

<Document>

<name>OR1.kml</name> <StyleMap id="msn_ylw-pushpin"> <Pair>

<styleUrl>#sn_ylw-pushpin</styleUrl> </Pair> <Pair>

<key>highlight</key> <styleUrl>#sh_ylw-pushpin</styleUrl> </Pair> </StyleMap>

<Style id="sh_ylw-pushpin"> <IconStyle>

<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href> </Icon>

<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/> </IconStyle> <ListStyle> </ListStyle> </Style>

<Style id="sn_ylw-pushpin"> <IconStyle>

<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href> </Icon>

<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/> </IconStyle>

<ListStyle> </ListStyle> </Style> <Placemark>

<longitude>-122.7583711698369</longitude>

<latitude>38.38922415809942</latitude>

<altitude>0</altitude>

<range>14591.7166300043</range>

<heading>0.04087372005871314</heading> <altitudeMode>relativeToGround</altitudeMode> </LookAt>

<styleUrl>#msn_ylw-pushpin</styleUrl> <Point>

<coordinates>-122.8239277647483,38.40273084940345,0</coordinates> </Point> </Placemark> <Placemark>

<longitude>-122.7677364592949</longitude>

<latitude>38.3819544049429</latitude>

<altitude>0</altitude>

<range>11881.3330990845</range>

<heading>-8.006283077460853e-010</heading> <altitudeMode>relativeToGround</altitudeMode> </LookAt>

<styleUrl>#msn_ylw-pushpin</styleUrl> <Point>

<coordinates>-122.8064486052584,38.40786910573772,0</coordinates> </Point> </Placemark> <Placemark>

<longitude>-122.7677364592949</longitude>

<latitude>38.3819544049429</latitude>

<altitude>0</altitude>

<range>11881.3330990845</range>

<heading>-8.006283077460853e-010</heading> <altitudeMode>relativeToGround</altitudeMode> </LookAt>

<styleUrl>#msn_ylw-pushpin</styleUrl> <Point>

<coordinates>-122.7911077944045,38.41500788727795,0</coordinates> </Point> </Placemark>

CHAPTER 10

+2 0

Responses

  • ilse
    How to load kml into emulator control?
    7 years ago

Post a comment