[SOLVED] trouble with using kml as location provider

Put your problem here if it does not fit any of the other categories.

[SOLVED] trouble with using kml as location provider

Postby androidonkey » Mon Mar 03, 2008 12:37 am

Hi everyone,

I'm having trouble retrieving the latitude and longitude data from a kml file using a small android app. It keeps returning latitude = 0.0 and longitude = 0.0. I'm pretty sure that i've pushed the kml file properly to the emulator (no extension, file name is "kml", has properties file, and is stored under misc/location/mygps/).

Any help/advice will be greatly appreciated. Thanks!

-androidonkey

Here is the app:

LocationManager lm = (LocationManager)getSystemService(LOCATION_SERVICE);
Location l = lm.getCurrentLocation("mygps");

String longitude = l.getLongitude() + "";
String latitude = l.getLatitude() + "";

String CurrentLat = latitude;
String CurrentLong = longitude;

And here are the contents of the KML file:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>1065 Brea Mall, Brea, CA 92821.kml</name>
<StyleMap id="default_copy0+nicon=http://maps.google.com/mapfiles/kml/pal3/icon60.png+hicon=http://maps.google.com/mapfiles/kml/pal3/icon52.png">
<Pair>
<key>normal</key>
<styleUrl>#default_copy0+icon=http://maps.google.com/mapfiles/kml/pal3/icon60.png</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#default_copy0+icon=http://maps.google.com/mapfiles/kml/pal3/icon52.png</styleUrl>
</Pair>
</StyleMap>
<Style id="default_copy0+icon=http://maps.google.com/mapfiles/kml/pal3/icon52.png">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pal3/icon52.png</href>
</Icon>
</IconStyle>
<LabelStyle>
<scale>1.1</scale>
</LabelStyle>
</Style>
<Style id="default_copy0+icon=http://maps.google.com/mapfiles/kml/pal3/icon60.png">
<IconStyle>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pal3/icon60.png</href>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name>1065 Brea Mall, Brea, CA 92821</name>
<address>1065 Brea Mall, Brea, CA 92821</address>
<LookAt>
<longitude>-117.883593</longitude>
<latitude>33.916991</latitude>
<altitude>0</altitude>
<range>1000</range>
<tilt>0</tilt>
<heading>0</heading>
</LookAt>
<styleUrl>#default_copy0+nicon=http://maps.google.com/mapfiles/kml/pal3/icon60.png+hicon=http://maps.google.com/mapfiles/kml/pal3/icon52.png</styleUrl>
<Point>
<coordinates>-117.883593,33.916991,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
Last edited by androidonkey on Mon Mar 03, 2008 4:48 pm, edited 1 time in total.
androidonkey
Junior Developer
Junior Developer
 
Posts: 13
Joined: Mon Feb 18, 2008 10:20 am

Top

[SOLVED]

Postby androidonkey » Mon Mar 03, 2008 4:48 pm

All I had to do was close adb.exe manually (it didn't close automatically whenever I closed the emulator window or eclipse) and restart the emulator - once I did, Android recognized my custom location provider. Crikey.
androidonkey
Junior Developer
Junior Developer
 
Posts: 13
Joined: Mon Feb 18, 2008 10:20 am

Postby res » Mon Mar 03, 2008 5:16 pm

Ah good point, glad you got it working :D
res
Senior Developer
Senior Developer
 
Posts: 146
Joined: Tue Nov 20, 2007 8:14 pm
Location: United States

help me

Postby ramonrabello » Fri Jun 13, 2008 9:29 pm

i tried to shut down both adb.exe and eclipse, restart the emulator but latitude and longitude is still 0 :roll: . Anyone knows other solution?
ramonrabello
Freshman
Freshman
 
Posts: 4
Joined: Sat Jan 05, 2008 8:51 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 25 guests