Is it possible to launch Huawei Petal Maps with navigation from point A to point B using intent just like in google maps? If yes, how?
Yes, you can use an intent to launch the Petal Map app, and then use navigation functions in the app.
Deep link example:
mapapp://navigation?saddr=xxx&daddr=xxx&language=xx&type=xxx
mapapp://navigation?saddr=home&daddr=company&language=en&type=drive
mapapp://navigation?type=exit
To use this function, you need to set uriString to the following:
"mapapp://navigation?saddr=25.102916,55.165363&daddr=25.164610000000,55.228869000000&language=en&type=drive"
Sample code after modification:
String uriString = "mapapp://navigation?saddr=25.102916,55.165363&daddr=25.164610000000,55.228869000000&language=en&type=drive";
Uri content_url = Uri.parse(uriString);
Intent intent = new Intent(Intent.ACTION_VIEW, content_url);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
For more details, see docs.
As it would seem from this link, India is currently not among the supported regions for Huawei Petal Map. Currently, you would not be able to use it for navigation.
Related
I am developing a geo located based app, and I have an option : "Show me the way" that should show the map and how to get there, so far is working with google maps, and also with Waze, the Uber app is showing in the App selector to open the action (Intent) that I'm throwing from the app, but it does not work with the data is receivng, so What additional data should I send? I was reading the Uber official documentation but it's more for web and URL based calls and I haven't found an example with the "geo" tag Intent that I'm using and works for other apps.
The code I am using to throw the Intent is this:
case R.id.menu_ride:
{
String uri = "geo: "+newPlace.getLatitude()+","+newPlace.getLongitude();
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));
return true;
}
I don't know if it is the right way to do it but this is the way I am using it and it's working on Google Maps, Uber and Waze with no problems:
case R.id.menu_ride:
{
String uri = "geo: "+newPlace.getLatitude()+","+newPlace.getLongitude() +
"?q="+newPlace.getLatitude()+","+newPlace.getLongitude() ;
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));
return true;
}
Seeems like you had to add the GET parameter "q" for the query.
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.
How can I launch route activity on google maps from my app without specifying the destination? I am using:
Uri gmmIntentUri = Uri.parse("google.navigation:q=<>");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
Bad behavior :
But the "to" field in google maps has "<>" string, and if I write:
Uri gmmIntentUri = Uri.parse("google.navigation:q=");
But this not working.
The idea is:
Right behavior:
There doesn't seem to be a way for you to specifically go to a specific Activity in the official Maps app (empty destinations). If you look at the Google Maps Intent, it exposes several intents that can launch Maps to display, search, navigate and use Street View. For searching location, you are required to have coordinates or optional queries and labels.
HI Im using a intent to send to a google maps a position via geo: with his latitude and longitude and mark a position with a titles. but know that i update the google maps v7.0.1 on android 4.2.2 it wont display the mark that i did in the code. here is the code that i used for make the call of maps.
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:"+latitude+","+longitude+"?q="+latitude+","+longitude+"("+name+")"));
intent.setComponent(new ComponentName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"));
startActivity(intent);
It seems that it is not supported any more.
Also this syntax is not mentioned in Google Uris, RFC 3986 or geo: Uri Draft.
If google maps does not find the given name at this point, there will be no search result. You can remove the name and google maps will draw a marker at the given point with its street name.
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:"+latitude+","+longitude+"?q="+latitude+","+longitude+"("+name+")"));
intent.setComponent(new ComponentName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"));
startActivity(intent);
From my app, I currently invoke google map using this:
Uri uri = Uri.parse("geo:" + "45.420833" + "," + "-75.69?z=13");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
I need to turn on the traffic layer upon launching the intent.
I couldn't find any simple way to do so online. I couldn't find an extra parameter to do so either :(
Any idea?
Altough I have not tried it yet, this might work for you if you are using a mapView within the app:
mapView.setTraffic(true);
I need to turn on the traffic layer upon launching the intent.
You will have to embed MapView for that, AFAIK.