Sunday, June 20, 2010

Launching Google Map using Intent in Android

Using intent we can open google map. The URI for launching google map is geo:13.042206,80.17000?z=10

The complete code snippet is,

 

double latitude = 13.042206;
double longitude = 80.17000;
uri = Uri.parse("geo:" + latitude + "," + longitude +"?z=10");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);


The latitude and longitude , I specified here is for Chennai. We can also specify the zoom level. Here I specified the zoom level as 10.

The screenshot is,



From the menu you will get all the options that are available in google map as,

No comments:

Post a Comment

Androidians