I have a web app where if a user clicks on a link it should open up a map. The best solution that I can think of is to open up a new tab/window to google maps using the
For me, the best answer was to standardize a map tag, such as "MAP:".
Then to make an address invoke maps, preface it with MAP:
.
So to tell a friend where something is, use something like: Map: 123 any street PA 98234
.
Then when the address is clicked (for a phone, tapped), the default mapping app is invoked.
Added from comment:
The idea was for e-mail and texting, however if you want a code example, this works on android:
try
{
String uri = "geo:0,0?q=" + Address;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(intent);
}
catch (SecurityException es)
{
if (LOG) Log.e("Dbg", "Map failed", es);
}
catch (ActivityNotFoundException e)
{
if (LOG) Log.e("Dbg", "Map failed", e);
}