简体   繁体   English

Android静态地图API V2适用于Android上的商家

[英]Google Static Maps API V2 for business on Android

I am trying to use Google Static Maps API V2 for business on Android. 我正在尝试将Google Static Maps API V2用于Android上的业务。 Firstly, generated signature using client Id and Crypto Key, and made the below call to Google on Android device. 首先,使用客户端ID和加密密钥生成签名,并在Android设备上向Google调用以下内容。 (Modified client id) (修改后的客户端ID)

http://maps.googleapis.com/maps/api/staticmap?center=51.52574%2C-0.07724&zoom=15&size=510x271&sensor=false&scale=2&client=gme-XXXXXXXXX&signature=DVEffwz-at_xWsarlhLLjURWfaA http://maps.googleapis.com/maps/api/staticmap?center=51.52574%2C-0.07724&zoom=15&​​size=510x271&sensor=false&scale=2&client=gme-XXXXXXXXX&signature=DVEffwz-at_xWsarlhLLjURWfaA

But I have the below error message. 但我有以下错误消息。

The Google Maps API server rejected your request. Google Maps API服务器拒绝了您的请求。 Unable to authenticate the request. 无法验证请求。 Provided 'signature' is not valid for the provided client ID. 提供的“签名”对提供的客户端ID无效。 Learn more: https://developers.google.com/maps/documentation/business/webservices/auth 了解详情: https//developers.google.com/maps/documentation/business/webservices/auth

However I can open correct map on desktop browser using that url, so the signature and url is fine. 但是我可以使用该URL在桌面浏览器上打开正确的地图,因此签名和网址很好。 I think I need to set something else, but I do not know what I should set up more. 我想我需要设置其他东西,但我不知道我应该设置更多。

If anyone has this experience, please let me know how to setup Google Static Maps API V2 for business on Android. 如果有人有这方面的经验,请告诉我如何在Android上设置Google Static Maps API V2 for business。

Thanks in advance. 提前致谢。

this is the format that my URL is in, maybe you have it wrong 这是我的网址所在的格式,也许你错了

URL = "http://maps.google.com/maps/api/staticmap?center=" +lati
 + "," + longi + "&zoom=18&size=400x380&maptype=hybrid&sensor=false&
key=AIzaSyCWRdg8Kiy7CI9tsKjt57bbTIrV_L6QQ3c";
  1. Go to the Google Cloud Console. 转到Google云端控制台。 https://cloud.google.com/console/ https://cloud.google.com/console/
  2. Select your project. 选择您的项目。
  3. In the sidebar on the left, select APIs & auth. 在左侧边栏中,选择API和auth。 Then select Credentials. 然后选择凭据。
  4. Create a new client id for OAuth 2.0. 为OAuth 2.0创建新的客户端ID。
  5. Choose Installed appilcation & Android. 选择已安装的appilcation和Android。
  6. Use new client id in your application. 在您的应用程序中使用新客户端ID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM