Android - 403 when requesting map image with valid API key

I'm trying to load a static map API image, but it keeps 403-ing, which seems to be because of an invalid API key (based on the docs https://developers.google.com/maps/documentation/maps-static/error-messages)

I've verified in the console that the API key is valid and non-expired. The url https://maps.googleapis.com/maps/api/staticmap?center=47.3,-122.359&zoom=12&size=411x231&maptype=roadmap&mobile=true&scale=2&key=xxxxx loads fine in the browser, so I take that to mean that the API key is valid.

The API key lives in the AndroidManifest.xml file

<meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="xxxxx"/>

Anyone else experience this?

2 answers

  • answered 2018-11-16 22:01 Eric C

    Can you post code for how you are accessing and building the url to be sent?

    Also if you are on a premium plan, then you will need to add a signature metadata field as described here: https://developers.google.com/maps/documentation/maps-static/get-api-key?hl=en_US#dig-sig-key.

  • answered 2018-11-16 22:11 Lady_ari

    So, I did a bit of digging, and it seems like Google made a change in June of this year where the url now requires the key to be sent. They no longer support keyless usage. This is terrible, since it breaks older app versions that used the old structure.