google-mapsfluttergoogle-maps-static-api

google static map api call not working do I need a billing account or api call is wrong?


I generated api key without creating a billing account. here is the URL that I created

https://maps.googleapis.com/maps/api/staticmap?size=600x400&center=37.0902%2C-95.7192&zoom=4&markers=Marker%7BmarkerId%3A+MarkerId%7Bvalue%3A+LatLng%2823.8303239%2C+90.4218414%29%7D%2C+alpha%3A+1.0%2C+anchor%3A+Offset%280.5%2C+1.0%29%2C+consumeTapEvents%3A+false%2C+draggable%3A+false%2C+flat%3A+false%2C+icon%3A+Instance+of+%27BitmapDescriptor%27%2C+infoWindow%3A+InfoWindow%7Btitle%3A+null%2C+snippet%3A+null%2C+anchor%3A+Offset%280.5%2C+0.0%29%7D%2C+position%3A+LatLng%2823.8303239%2C+90.4218414%29%2C+rotation%3A+0.0%2C+visible%3A+true%2C+zIndex%3A+0.0%2C+onTap%3A+null%7D&key=MY-API-KEY

the MY-API-KEY is where I put my API key. but when I call this URL for my app it gives HTTP request failed, statusCode: 403

when I hit it in browser I get The Google Maps Platform server rejected your request. You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started

is there something wrong with the URL or is it not possible to access google static map API without a billing account?


Solution

  • Please don't forget to Enable Maps SDK for Android from the library section of the API & Service menu. https://cloud.google.com/maps-platform/

    After Getting Api Key please paste it in below code in AndroidManifest.xml file and add this code as mentioned below

    <application>
    ...
    <meta-data android:name="com.google.android.geo.API_KEY"
               android:value="your API key"/>
    ...
    </application>