using kml file

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

using kml file

Postby mystic-d » Thu Apr 10, 2008 10:05 pm

hey
im trying to use a kml file as a mock gps, but cant get it to work...
my code is:
Code: Select all
    LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); 
    LocationProvider provider = locationManager.getProvider("gps");   

and i was put the kml file inside /data/misc/location/gps/kml
i cant get over the second line ('LocationProvider provider = locationManager.getProvider("gps");') , its like it cant find something or something else..
can someone know what the problem is ?
thanks !
mystic-d
Junior Developer
Junior Developer
 
Posts: 15
Joined: Thu Mar 20, 2008 1:29 am

Top

Postby plusminus » Thu Apr 10, 2008 11:35 pm

Hello mystic-d,

what do you mean with "cant get it to work" :?:

You'll need restart the emulator after copying the file to that location.
(Put it to "/data/misc/location/gps/" not to "/data/misc/location/gps/kml/" :!: just the same folder as where the "nmea" is.)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby mystic-d » Fri Apr 11, 2008 4:48 am

my nmea file is placed "/data/misc/location/gps/nmea" ... is it good or did i need to move it from there ?
cant get it to work i mean, that im getting a NULLEXCEPTION..
thanks !
mystic-d
Junior Developer
Junior Developer
 
Posts: 15
Joined: Thu Mar 20, 2008 1:29 am

Postby mystic-d » Sat Apr 12, 2008 10:51 am

ok, i found that my kml file wasnt good, so i tryed to use the kml from the thread :
http://www.anddev.org/solved_trouble_wi ... t1151.html
and now i get it to work but now i got that my lat and long is always 0 ,
the code is:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
  2.  
  3. Location myLocation = locationManager.getCurrentLocation("gps");
  4.  
  5. TextView eText = (TextView) findViewById(R.id.txt);
  6.  
  7. eText.setText("Current location is: lat: " + myLocation.getLatitude() + " long: " + myLocation.getLongitude());
  8.  
  9.  
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


my properties file in the /data/misc/location/ is:

requiresNetwork false
requiresSatellite false
requiresCell false
hasMonetaryCost false
supportsAltitude true
supportsBearing true
supportsSpeed false
repeat true
accuracy 100
powerRequirement 1

and i put the permission in the AndroidManifest.xml file are:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <uses-permission android:name="android.permission.ACCESS_LOCATION" />
  2.  
  3. <uses-permission android:name="android.permission.ACCESS_GPS" />       
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


and i dont have any other file in that directory beside the "kml" file and "properties" file
and i tryed to stop the adb.exe and start the emulator again (like i saw in the thread above that solve this problem)
does someone know what is the problem ?
Thanks !
mystic-d
Junior Developer
Junior Developer
 
Posts: 15
Joined: Thu Mar 20, 2008 1:29 am

Postby mystic-d » Tue Apr 15, 2008 9:48 pm

i was try to look at the logCat , and the parse of the kml file is all ok..
i also saw this information : (on booting process)
tag Message
"
TrackProvider lon=-117.883593, lat=33.916991, alt=0
LocationManagerService loadProviders
LocationManagerService loadProviders: already loaded
"
and than when my application is starting i saw this:
"
DEBUGTAG lat = 0 (this is for the row: Log.d("DEBUGTAG", "lat = : "+ l.getLatitude()); )
"
maybe someone know what is the problem ?
thanks !
mystic-d
Junior Developer
Junior Developer
 
Posts: 15
Joined: Thu Mar 20, 2008 1:29 am

Top

Return to Map Problems

Who is online

Users browsing this forum: Google Feedfetcher and 3 guests