How to send an address in the Android application on Google Maps

Is there a way to set the address in the application, so when it is clicked it automatically opens it in Google Maps? I can finish using Maps in my application, but this is a simple reference application, just to find the address.

+4
source share
1 answer

You do this with Intent .

The various URI formats you can use are as follows:

geo:latitude,longitude geo:latitude,longitude?z=zoom geo:0,0?q=my+street+address geo:0,0?q=business+near+city 

See http://developer.android.com/guide/appendix/g-app-intents.html for more details.

You create a URI and pass it to an intent like this.

 String uri = "geo:latitude,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); 

You can also make sure that the Google Maps application is actually installed on the device, described here , so you do not start the devices that "Google Maps" is installed (Amazon Kindle, Barnes and Noble Nook, etc.).

+17
source

All Articles