How to open standard Google Map application from my application?
You should create an Intent
object with a geo-URI:
String uri = String.format(Locale.ENGLISH, "geo:%f,%f", latitude, longitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
context.startActivity(intent);
If you want to specify an address, you should use another form of geo-URI: geo:0,0?q=address
.
reference : https://developer.android.com/guide/components/intents-common.html#Maps
open google maps through intent for specific location in android
I have not tested this but you could try :
First method:
String uri = String.format(Locale.ENGLISH, "geo:%f,%f", latitude, longitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
context.startActivity(intent);
EDIT:
This might not work with Google maps 7,0
hence you could change the uri to :
Second option:
String geoUri = "http://maps.google.com/maps?q=loc:" + lat + "," + lng + " (" + mTitle + ")";
where mTitle
is the name of the location.
Third option:
geo:0,0?q=my+street+address
Fourth option:
String map = "http://maps.google.co.in/maps?q=" + yourAddress;
Hope that works and helps :D..
how to open standard Google Map application from my application and after choose a location then redirect back to my application?
The simple answer is (as much I know) - No you cannot do it. You can just start Google maps by an intent but you cannot get back the data from it.
If you need something like this, you need to have Google Maps API and show maps directly in your app.
Launching Google Maps Directions via an intent on Android
You could use something like this:
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?saddr=20.344,34.34&daddr=20.5666,45.345"));
startActivity(intent);
To start the navigation from the current location, remove the saddr
parameter and value.
You can use an actual street address instead of latitude and longitude. However this will give the user a dialog to choose between opening it via browser or Google Maps.
This will fire up Google Maps in navigation mode directly:
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("google.navigation:q=an+address+city"));
UPDATE
In May 2017 Google launched the new API for universal, cross-platform Google Maps URLs:
https://developers.google.com/maps/documentation/urls/guide
You can use Intents with the new API as well.
How to open **Google Maps** application from my current application?
You have to use a Intent.
Here you have a real example
http://www.tutorialforandroid.com/2009/10/launching-other-application-using-code.html
Here you have an theoric example
Open another application from your own (intent)
Here you have the Android documentation
http://developer.android.com/reference/android/content/Intent.html
Hope it helps! :)
How to Open and Directing Google Maps using Intent?
String strUri = "http://maps.google.com/maps?q=loc:" + latitude + "," + longitude + " (" + yourLocationName + ")";
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(strUri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(intent);
Open Google Maps app if available with flutter
I found my issue: this needs to be in the plist file. The code in the question above is fine. (The SO answer referenced in the question only mentioned the "comgooglemaps" string.)
<key>LSApplicationQueriesSchemes</key>
<array>
<string>googlechromes</string>
<string>comgooglemaps</string>
</array>
Docs: https://developers.google.com/maps/documentation/ios-sdk/start#step_7_declare_the_url_schemes_used_by_the_api
Related Topics
How Does Evaluatejavascript Work
How to Create a .CSV on Android
Sharing a Png Image in Drawable Folder
How to Implement a Setonitemclicklistener Firebaserecyclerviewadapter
Importing Module in Android Studio
Get Application Context Returns Null
Android: How to Center Title in Toolbar
Get Listview Item Position on Button Click
Work Around Canvas.Clippath() That Is Not Supported in Android Any More
How to Store SQLite Database Directly on Sdcard
Android Exception: Did You Forget to Call 'Public Void Setup (Localactivitymanager Activitygroup)'
Error:Cause: Unable to Find Valid Certification Path to Requested Target
How to Resolve Java.Util.Zip.Zipexception
Listfragment Onlistitemclick Not Being Called
Customize Check Box Preference