问题
I'm launching the builtin Maps app (7.1.0) via an Intent, however none of the request url's I'm sending it seem to be working.
I was wondering what the correct syntax is for the url/uri argument.
I thought it was a static-map request, but the built-in map app isn't a static map, and is probably why they do not work.
The older style v1 request strings do not work either.
Is it even possible to send requests to the map app via a url/uri intent argument since v2 ?
Any help or tips would be greatly appreciated (I just want to use the built-in map app, and feel I shouldn't have to implement my own MapActivity/Fragment, since I'm not doing anything fancy, just a simple plot).
Here is the code that fires the map:
//string url = "http://maps.googleapis.com/maps/api/staticmap?geo:50.95144,6.98725?q=50.95144,6.98725%20(Disneyland)&zoom=13&size=600x300&sensor=true";
//string url = "http://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&sensor=true";
string url = "http://maps.googleapis.com/maps/api?center=Brooklyn+Bridge,New+York,NY";
Uri uri = Uri.Parse( url );
Intent intent = new Intent(Android.Content.Intent.ActionView, Uri.Parse(url));
intent.SetClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
StartActivityForResult(intent, 0);
Thank you.
回答1:
Just specify the query parameters and their values, and omit the uri scheme (http://), server name (maps.googleapis.com) and resource path (/maps/api).
However, the center param doesn't seem to work (for me anyway)
string url = "center=Brooklyn+Bridge,New+York,NY"
so as a work around, I use the geo and q params together
string url = "geo:0,0?q=Brooklyn+Bridge,New+York,NY";
OR
string url = "http://maps.google.com/maps?q=new+york";
来源:https://stackoverflow.com/questions/18881689/google-maps-v2-intent-uri-arguments