简体   繁体   中英

Google Static Maps API V2 for business on Android

I am trying to use Google Static Maps API V2 for business on Android. Firstly, generated signature using client Id and Crypto Key, and made the below call to Google on Android device. (Modified client 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

But I have the below error message.

The Google Maps API server rejected your request. Unable to authenticate the request. Provided 'signature' is not valid for the provided client ID. Learn more: 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. 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.

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. https://cloud.google.com/console/
  2. Select your project.
  3. In the sidebar on the left, select APIs & auth. Then select Credentials.
  4. Create a new client id for OAuth 2.0.
  5. Choose Installed appilcation & Android.
  6. Use new client id in your application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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