Linking to a custom google map - android

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.

Related

Opening directions in Google maps directly

I am using below code to open direction from current location to particular location in Google Maps.
But the code first shows me "Open With dialog" giving user choice to open with other components also. I want user to be taken directly to Google maps without giving him choice to select. How can I do that?
String uri = "https://maps.google.com/maps?f=d&daddr="+location;
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(i);
You can use the below format (not officially supported):
https://www.google.com/maps/dir/My%20location/DESTINATION_ADDRESS
OR
https://www.google.com/maps?saddr=My+Location&daddr=DESTINATION_ADDRESS
eg:
https://www.google.com/maps/dir/My%20location/world%20of%20coca%20cola
https://www.google.com/maps?saddr=My+Location&daddr=world%20of%20coca%20cola
Where DESTINATION_ADDRESS is the destination address you want to navigate to.

Android Follow google+ page directly through button

I want to put one button to follow my google plus page through click on that button, means when i click on Google+ button that automatically follow my page, i much goggling but not find
exact,so any one please help me to solve it.
Sorry ! There is no custom button for a Google+ following page.i think, i am using below code is useful for you. this code is directly open Google+ page and default follow button.
public void openGPlus(String profile) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName("com.google.android.apps.plus",
"com.google.android.apps.plus.phone.UrlGatewayActivity");
intent.putExtra("customAppUri", profile);
startActivity(intent);
} catch (ActivityNotFoundException e) {
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("https://plus.google.com/" + profile + "/posts")));
}
}
call this method such as openGPlush("numeric page id");
There is no native support for a Google+ follow button. See the documentation. There is however support for a +1 button as you can see here.
If you really want a Google+ follow button, you could theoretically use a WebView and put a Web API follow button inside, as documented here

Draw route on map without MapActivity

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.

google GetDirection in Android

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);

Launching Google Maps with more parameters

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...

Categories

Resources