I have read a lot of stuff about launching Google Maps in Android.
That's pretty easy:
Uri uri = Uri.parse("geo:38.899533,-77.036476");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
The problem is that the map is shown at a high zoom level and there is no marker on the map.
So, if the user move a little bit or something happen, the point is lost.
Is that possible to add a marker like this:
http://img.skitch.com/20100820-da3n4r7h5xbsu6bsx4p4ujjghc.jpg
or like this:
http://img.skitch.com/20100820-qg7k2m5wtwm3j5phphrgc8tb53.jpg
So i can be sure that even if the user move the map, he will be able to find this place again.
Thank a lot for any help.
The geo: scheme can take a zoom level:
geo:latitude,longitude?z=zoom
but as far as I know, you can't specify a marker in the intent.
If you use this mode of the geo: scheme, it might give you what you want:
geo:0,0?q=my+street+address
geo:0,0?q=business+near+city
Seem that the correct answer is no, and I have currently no workaround...
Related
I'm opening a google map using my android program. I did it with the following URL,
http://maps.google.com/maps? saddr=31.186371,121.489885&daddr=31.249351,121.45905&mode=driving
But this opens a view like,
I want to open the shortest path(1st one in list view) from these paths. Is there a way to do this? How may I do this?
According to the documentation, you can launch the turn by turn navigation by this intent:
google.navigation:q=a+street+address
you can use these code to launch the intent:
Uri gmmIntentUri = Uri.parse("google.navigation:q=Taronga+Zoo,+Sydney+Australia");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
As you might able to tell, this can only give a turn-by-turn direction from current location to point A, but not point A to point B. You should consider using the web direction API and draw the polyline on your own Google Maps to gain more controls.
I want to draw a path on map between known points(lat, long) using:
String uri = "http://maps.google.com/maps?f=d&hl=en&saddr="+source_latitude+","+source_longitude+"&daddr="+destination_latitude+","+destination_longitude;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(intent);
But instead of just drawing route, Google Maps shows menu Car/Bus/By foot, trying to make a route from my current location to those points. What am I doing wrong? Is it still possible to draw route on map using the method above?
By running this intent you are basically opening an "outside" application - Google Maps that is not related to your application. the behavior you are receiving is the behavior that should be for the version of Google Maps you have in your phone. You can't edit the way it behaves, only the things that you are allowed to change using the settings screen of this application.
You have to parse the xml or json that your are using in the url in an Asynctask class and draw it on the map.
I'm trying to add a Map element to an app that I'm developing. I know how to add a google map, and add overlays through the many tutorials there are online. What I want to do however is link to a google map that I've already created online in google maps "My Places" (this has around 100 place markers that regularly change). Is there a way to do this?
I've decided to just pass the information over to google maps app and let them help by creating a button that simply launches google maps with the link to the specific map as a DataUri. Heres the code below for my solution, if anyone else with a similar need stumbles across this.
Button map = (Button)findViewById(R.id.map);
map.setOnClickListener(new OnClickListener() {
public void onClick(final View v) {
String uri = String.format("https://maps.google.co.uk/....."); // the link copied and pasted from my maps in google
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);
}
});
Maybe you can simply add a webview and load your Google Map inside, if it's a web version.
I have used this following code for getting route for two directions but i need to implement multiple destination options in android like GetDirections.
Even i tried the method of drawline() functionality also but it will not show the route instructions like (turn left,right, etc.,).
please can any one help me for code the route path or to embed the feature of waypoints listed link below
https://google-developers.appspot.com/maps/documentation/javascript/examples/directions-waypoints
Code
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?saddr=st.%20louis,mo&daddr=washington,dc%20to:chicago,il%20to:new%20york,ny");
startActivity(intent);
I want to set paths on a Google maps. I’ve done some coding and able to draw single paths on a Google map. I want to know if there is any method to accomplish my objective. How can I do this?
want to show multiple paths between two Geo coordinators.
I’m new to this and can you please help me to do this. Thank you.
try this
String uri = "http://maps.google.com/maps?saddr=" + (srcLocation.getLatitude())+","+(srcLocation.getLongitude())+"&daddr="+destLat+","+destLon;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
Draw route using this. This is for one route.