google静态地图api调用不起作用,我需要一个计费帐户还是api调用错误?

问题描述 投票:0回答:1

我生成了api密钥,但未创建结算帐户。这是我创建的URL

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

MY-API-KEY是我放置API密钥的位置。但是当我为我的应用程序调用此URL时,它会显示HTTP request failed, statusCode: 403

当我在浏览器中点击它时,我得到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

URL是否有问题,或者没有计费帐户就无法访问google static map API?

google-maps flutter google-static-maps
1个回答
0
投票
在API和服务菜单的库部分中,

请不要忘记启用Maps SDK for Androidhttps://cloud.google.com/maps-platform/

获取Api密钥后,请将其粘贴到AndroidManifest.xml文件的以下代码中,并按如下所述添加此代码

<application>
...
<meta-data android:name="com.google.android.geo.API_KEY"
           android:value="your API key"/>
...
</application>
© www.soinside.com 2019 - 2024. All rights reserved.