Skip to content Skip to sidebar Skip to footer

How To Launch Google Map Intent With My Current Location

Im a newbie here in android programming. Here is my simple code just to launch the intent with the given coordinates. The problem is, how to get my current location and use it to s

Solution 1:

you have to try like this

Stringuri= String.format(Locale.ENGLISH, "geo:%f,%f", latitude, longitude);
Intentintent=newIntent(Intent.ACTION_VIEW, Uri.parse(uri));
context.startActivity(intent);

for more information visit here : https://developer.android.com/guide/components/intents-common.html#Maps

if you need with direction follow this

Intentintent=newIntent(android.content.Intent.ACTION_VIEW, 
    Uri.parse("http://maps.google.com/maps?saddr=20.344,34.34&daddr=20.5666,45.345"));
startActivity(intent);

Hope it will help you :)

Post a Comment for "How To Launch Google Map Intent With My Current Location"