Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

You Are Here: Using GPS and Google Maps in Android : Page 2

In the next installment of this Android series, you'll learn how to incorporate GPS and Google Maps into your Android application, so your users can see where they are, all the time.


advertisement

Testing GPS Functionalities

The DDMS tool in the Android plug-in for Eclipse allows you to test GPS functionality very easily. In Eclipse, switch to the DDMS view and locate the Location Controls section in the Emulator Control tab (see Figure 1).


Figure 1. The Location Controls Section: This section allows you to test GPS functionality on the Android emulator.
 
Figure 2. The New Location Information: When the GPS data is received, the application displays the latitude and longitude obtained.

There are three separate tabs in the Location Controls section. First, you can manually send in the coordinates by specifying the latitude and longitude. When the GPS data is received on the Android emulator, the application will display the latitude and longitude obtained (see Figure 2).



Another way to send in geographical locations is to use a .GPX file. GPX (GPS Exchange Format) is a light-weight XML data format for interchange of GPS data. You can download GPS samples here. Once a .GPX file is downloaded, click the Load GPX… button to load the .GPX file (see Figure 3).

You can click the Play button to send a series of coordinates to the Android emulator at regular time intervals. The Android Eclipse plug-in also supports KML (Keyhole Markup Language) files. You can download a sample .KML file here. Like the .GPX file, you can also send a series of coordinates to the Android emulator by clicking on the Play button (see Figure 4).


Figure 3. Loading a .GPX File: Click the Load GPX button to load the .GPX file.
 
Figure 4. Loading a .KML File: Sending coordinates to the .KML file.

If you don't use Eclipse, you can also telnet to the Android emulator and use the geo command to send GPS coordinates to the emulator:

C:\>telnet localhost 5554 Android Console: type 'help' for a list of commands OK geo fix -82.411629 28.054553 OK

The geo command also allows you to send NMEA data sentences, like this:

geo nmea $GPGGA,001431.092,0118.2653,N,10351.1359,E,0,00,,-19.6,M,4.1,M,,0000*5B



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap