View Single Post
Old 11-20-2007, 12:02 PM   #3
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

To get the location the most simple way is to implement LocationListener.
To use the maps you have to build a location document.
I made myself a static utility class to do this (and invoke the maps app).

I'll post you a sample. I use an own location-class but you can easily replace them with QualifiedCoordinates.

be warned though that the internal gps of the 8800 is quite bad (maybe that was the message the man with the hammer tried to deliver)

Code:
	public static void showRoute(Location location1, Location location2, String error){
		String route = "<lbs>" + "<getRoute>" +
		"<location y='" +
		(int)(location1.getLatitude()*100000)+
		"' x='"
		+(int)(location1.getLongitude()*100000)+
		"' />"+
		"<location y='" +
		(int)(location2.getLatitude()*100000)+
		"' x='"
		+(int)(location2.getLongitude()*100000)+
		"' />"+
		"</getRoute>" +
		"<location-document>"
			+"<location y='"
			+(int)(location1.getLatitude()*100000)
			+"' x='"
			+(int)(location1.getLongitude()*100000)
			+"' label='"
			+location1.getCity()
			+"' description='"
			+"' zoom='10'/></location-document>"
			+"</lbs>";
		try{
		Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments(
				MapsArguments.ARG_LOCATION_DOCUMENT, route));
	} catch (Exception e) {
		handleExeption(error);
	}
	}
__________________
java developer, Devinto, hamburg/germany
Offline   Reply With Quote