Is there a working way (i heard that as of update 7.0 there were some changes) to display a marker with a position given by latitude/longitude with a label?
geo:?q=latitude, longitude (Label) does not work...
Show point on google map via an intent:
String uri = "geo:"+ latitude + "," + longitude;
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));
You can also choose to place a point like so:
String uri = "geo:"+ latitude + "," + longitude + "?q=my+street+address";
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));
The Possible Query params options are the following:
Show map at location: geo:latitude,longitude
Show zoomed map at location: geo:latitude,longitude?z=zoom
Show map at location with point: geo:0,0?q=my+street+address
Show map of businesses in area: geo:0,0?q=business+near+city
Related
My question is very similar to this question (Android - How to launch Google map intent in android app with certain location, zoom level and marker) but the accepted answer is not working for me. It opens the map with the marker at the correct place and at the correct zoom level but then proceeds to zoom in to a street level view (zoom=16 or 17?).
I've search SO, I've read through this documentation but can't find a combination of place marker & zoom that do what I need.
I've tried with a few devices using Google Maps versions
8.2.0,
9.20.1,
9.36.2 &
9.42.3
Here is the result of the log print (the Uri used for the intent)
geo:39.29038619995117,-76.61219024658203?q=39.29038619995117%2C-76.61219024658203(Baltimore)&z=11
The answer from the other post is 4 years old now. Has Maps changed such that this doesn't work now? Did the other answer only work because they were setting the zoom to 17 and didn't notice it wouldn't settle on another zoom level? Am I missing something else?
To clearly state my question:
How can I use a geo intent to open a maps app to show a place marker and simultaneously choose a zoom level?
My code, based on the accepted answer from the other post.
double latitude = item.getLatitude();
double longitude = item.getLongitude();
String label = item.getName();
String uriBegin = "geo:" + latitude + "," + longitude;
String query = latitude + "," + longitude + "(" + label + ")";
String encodedQuery = Uri.encode(query);
String uriString = uriBegin + "?q=" + encodedQuery + "&z=11";
mListener.onListFragmentInteraction(uriString);
Then
public void onListFragmentInteraction(String url) {
Uri geoLocation = Uri.parse(url);
Log.d(TAG, "geo uri = " + geoLocation);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(geoLocation);
startActivity(intent);
}
#Gary99 for removing restaurant u have to add hiding map feature content here is the link(https://developers.google.com/maps/documentation/android-api/hiding-features)
Uri gmmIntentUri = Uri.parse("geo:37.7749,-122.4194?z=10&q=restaurants")
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri)
mapIntent.setPackage("com.google.android.apps.maps")
startActivity(mapIntent)
Can you launch from an APK a Google Maps intent that includes both a marker with a specific location and the user position? I've been trying to but haven't been able as of yet.
http://wptrafficanalyzer.in/blog/storing-and-retrieving-locations-in-sqlite-from-google-maps-android-api-v2/
try this site man i guess it will help.helped me though.
You can try this:
String uri = "http://maps.google.com/maps?saddr=" + latitude +","+ longitude +"&daddr=" + userLatitude + "," + userLongitude;
startActivity(new Intent(android.content.Intent.ACTION_DEFAULT, Uri.parse(uri)));
I followed the instructions at http://dev.sygic.com/documentation/custom-url-schema/ & http://help.sygic.com/entries/22207668-Developers-Only-Sygic-implementation-to-your-app-Android-SDK-iPhone-SDK-Url-Handler-
I am passing the coordinates to Sygic 12.991030334592057 as latitude and 77.80791163444519 as longitude.
Another com.sygic.aura://coordinate|12.9138|77.6680|drive
However Sygic says 'The coordinates are outside the map.'
String str = "http://com.sygic.aura/coordinate|" + latitude + "|"
+ longitude + "|" + type.toString();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str)));
I also tried
String str = "com.sygic.aura://coordinate|" + latitude + "|"
+ longitude + "|" + type.toString();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str)));
EDIT:
The type is enum. type.toString shows drive as the string.
What am I doing wrong?
Got the same problem. As enli was saying, the order of the lat,lon params is the opposite. This code worked for me:
String str = "com.sygic.aura://coordinate|" + lon + "|" + lat + "|" + type.toString();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str)));
in my phone, this example call launched sygic and started navigation:
com.sygic.aura://coordinate|-3.588678|37.176278|drive
Hope it helps
There is nothing wrong with your code. Have you made sure that those values of longitude and latitude are correct? With which application you got those co-ordinates?
I was working on the same code today and it seems that I had used longitude at the place of latitude and vice versa. Try interchanging the co-ordinates. That worked for me when I was in the same boat as yours. If that is not the case, make sure that you have Sygic maps for that location by manually navigating to that location by navigating to that location from Menu > Navigate to... > GPS coordinates.
I am trying to implement a functionality such that when a user enters an address in a text field and clicks on a button, that address should be copied into the destination field of Google maps and the user location should be set to "My Location" (his current location).
You can open google map in following way:
String CURRENT_LOCATION = "current_location_latitude, current_location_longitude";
String DESTINATION_LOCATION = "address_from_your_text_view";
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?saddr="+ CURRENT_LOCATION +" daddr="+DESTINATION_LOCATION));
startActivity(intent);
Note: You should get device/user current location from LocationManager
In order to show route on Google Map, Just call an intent which passes current and destination latitude and longitude. You may also pass address in any case if don't know lat-long. After doing this, its Google Map's job to show location. You may also show street view.
In below code, there are three parameters : current_lat, current_longi, dest_address
final Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?"
+ "saddr="+ current_lat+","+current_longi + "&daddr="+dest_address ));
intent.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");
startActivity(intent);
If you have current address and destination address, then you can write like this :
Uri.parse("http://maps.google.com/maps?"
+ "saddr="+curr_address+ "&daddr="+dest_address ));
If you have current and destination latitude and longitude both then you can write like this :
Uri.parse("http://maps.google.com/maps?"
+ "saddr="+ current_lat+","+current_longi + "&daddr="+ destt_lat+","+dest_longi ));
When you call this intent, Google Map shows option whether to draw route by bus or by walk.
I have made an application containing facility of viewing current location on map. I have used default Map Intent to show map. It Works fine in Emulator but when I am testing in my Android device (motorola Millstone) , Map works fine but after view map, my application is not responding.anyone have any ideas why it happens?
String path = "http://maps.google.com/maps?saddr=" + lat + ","+ lon + "&daddr=" + b_latt + "," + b_lang;
String geoUriString = new String(path);
Uri geoUri = Uri.parse(geoUriString);
Intent mapCall = new Intent(Intent.ACTION_VIEW, geoUri);
startActivity(mapCall);
You want to show One Marker at Current Location,but In the code you shown you are passing two values to draw path..
To show user's Current Location on Map via intent you need to call this way
String uri = "geo:"+ latitude + "," + longitude;
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));
You can see More on This Site