samus
samus

Reputation: 6202

Google Maps API v2 - Using API Key with built-in map app

If the built-in google-maps app is started via an intent, like so

string maps = "maps.googleapis.com/maps/api/staticmap"
string addr = "center=422+Android+Blvd+10110";
string key = "key=Ab4jk3j4k34jk34jk3"

string url =  "http://" + maps + "?" + addr + "&" + key

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,(int)ActivityRequestCode.Map);

can an API-key be specified in the request's url so that it will be serviced in the same way as when using them in requests from the v2 MapFragment/MapActivity/MapView ?

I think all my syntax and such is correct, because the first request I made today was fulfilled, but all subsequent requests have been ignored. It's as if the service is enforcing it's abuse policy against my IP.

A debug.keystore file was used to extract the SHA signature from, and an entry was made in the manifest file with the generated key:

<?xml version="1.0" encoding="utf-8"?>
<manifest>
    <application>       
        <meta-data android:name="com.google.android.maps.v2.API_KEY"
                   android:value="Ab4jk3j4k34jk34jk3" />
    </application>
    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.SET_DEBUG_APP" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
</manifest>

Since my requests are being ignored, I think maybe the built-in maps app doesn't support requests with keys specified in them. There are technical limitations as to why I cannot use the newer v2 style MapFragment/MapActivity (or whatever it's called).

I've tried three key types, two "browser apps" and one "android apps":

enter image description here

Thank you.

Upvotes: 0

Views: 299

Answers (2)

Cheesebaron
Cheesebaron

Reputation: 24460

The browser API key differs from the mobile application API key, so you will not be able to use the API key you have generated from your keystore as it is only for your app.

Using static (browser) maps is afaik without keys, however if you are displaying a map on a specific domain on a web page you will need to use an API key.

Upvotes: 1

Related Questions