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.
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)
I am working on an application that sends an e-mail with several information. Among the information is a link to the location of the user to Google Maps. A sample of the link would be:
http://www.google.com.ph/maps/place/14°39'3.8952"N121°2'57.4116"E/#14.651082,121.049281,17z
The code looks like this:
"Google Maps Link: http://www.google.com.ph/maps/place/" +
degToDMS(location.getLatitude()) + "\"N" +
degToDMS(location.getLongitude()) + "\"E/#" +
location.getLatitude() + "," + location.getLongitude() + ",17z");
I converted the degrees longitude and latitude to DMS using a formula I found online and it seemed to be returning good data. However, when I go check the email, the link looks like:
http://www.google.com.ph/maps/place/14°39'3.8952"N121°2'57.4116"E/#14.651082,121.049281,17z
and the hyperlink ends at the first double quote (") right before the N. This is actually a bit irritating and troubling because it doesn't link the entire link properly and it is cut.
How can I escape a double quote in a link? Or is there a better way to link to Google Maps?
I used URLEncode, thanks to for3st for the lead, as such:
final String urlRaw = degToDMS(location.getLatitude()) + "\"N" +
degToDMS(location.getLongitude()) + "\"E/#" +
location.getLatitude() + "," + location.getLongitude() + ",17z";
String encodedURL = "";
try {
encodedURL = URLEncoder.encode(urlRaw, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
where urlRaw is the "problematic' part of your url (where characters don't get escaped properly or something). You DON'T put in the http://.... because it will appear as such http%3A%2F%2Fwww.google.com.ph and yeah you don't want that.
Hence, I only escaped the latter part of my url, the one that starts with the DMS coordinates.
Once I have my encodedURL variable, I simply concat it to the rest of the starting URL as such:
String link = "Google Maps Link: http://www.google.com.ph/maps/place/" + encodedURL;
and not it works.
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)));
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
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