I am trying to build a google maps app. The app runs but I am unable to retrieve the map UI.
Logs shows :Authorization failure. Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
06-16 22:45:50.480 13860-14718/com.mapsapi.vatsan.googlemapsapidemo E/Google Maps Android API: In the Google Developer Console (https://console.developers.google.com)
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: **************************************
Android Application (;): 24:85:5A:C0:F8:0D:36:4C:1A:B9:45:B6:21:92:B0:6E:7D:71:55:08;com.mapsapi.vatsan.googlemapsapidemo
I have used the correct API Key.
What exactly i have to do?
I know there are diferent keys for debug and released apps.
i recomend API v3 too.
Try this to register your api key.
https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=24:85:5A:C0:F8:0D:36:4C:1A:B9:45:B6:21:92:B0:6E:7D:71:55:08%3Bcom.mapsapi.vatsan.googlemapsapidemo
It can take some minutes. Then you have to set your google_maps_key in your android app Manifiest.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSDSSDDDAAD...Your API KEY" />
If doesnt work and if you are using android studio, try creating a new Map Activity(It's V3), complete res/values/google_maps_api.xml with the key and the map gonna work.
How to create google map
Related
I've built a Flutter app using https://pub.dev/packages/google_maps_flutter for maps and I want to add directions as per https://medium.com/#shubham.narkhede8/flutter-google-map-with-direction-6a26ad875083, but I need to get the Google API key, which is injected into the app at build time in different ways depending whether it's Android or IoS.
I've spent about an hour googling, but I can't find a Flutter or native way of getting at the API key in the app. Is there a way?
If I understand rightly that you're trying to access the Google Maps API key from your native iOS and Android projects from within Flutter, this should work:
Use this: https://pub.dev/packages/flutter_native_config to read the Android manifest and the iOS Info.plist.
On Android the key will already be there as per the Google Maps docs.
You'll then need to move your API key in iOS to the info.plist then read it in instead of having it hardcoded: https://www.hackingwithswift.com/example-code/system/how-to-read-your-apps-version-from-your-infoplist-file
I'm fairly new to all this so any help is gratefully received. I have a flutter app that calls the Google Maps API. To call the API I pass it my Google API key and in order to try and make it secure I have set up application restrictions in https://console.cloud.google.com/
The problem is that now when I call the Maps API I get the follwoing error:-
This IP, site or mobile application is not authorized to use this API key
Below is a screenshot of the settings that I have applied. What have I done wrong?
UPDATE: Some more information
The relevant APIs are enabled. The SHA-1 Fingerprint is correct. My app is running in debug mode, the certificate is the debug one. If I unrestrict the API key then everything runs okay.
We are building hybrid app which will be on ios and android.
Our app is using google static map api. I'm not sure if we need ios key or web key for that.
right now I just generated web key, but then how authentication of key will work on it, since its not ios SDK map.
Google Static Maps API needs a web api key.
Pass your API KEY with 'key' parameter like below.
https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap
&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318
&markers=color:red%7Clabel:C%7C40.718217,-73.998284
&key=YOUR_API_KEY
https://developers.google.com/maps/documentation/static-maps/intro
Static Maps API has nothing to do with iOS and Android Maps SDKs. It is a separate API so you need the Static Maps API enabled on the project and generate a key for this API.
It simply allows you to embed a map image in your app, but the downside is that it cannot be made interactive.
A very useful tip on using the Static Maps API on a mobile device is to look at screen resolution of the target device and adjust the scale parameters.
I bought an API key for Google Map. I tried to implement the client key in a PhoneGap application.
<script src="http://maps.googleapis.com/maps/api/js?client=YOUR_CLIENT_ID&v=3.17"></script>
However, it doesn't work. I have an alert with the message: "your domain is not permitted."
I can't put a domain in the admin console, because it's a phonegap app and the file protocol doesn't work well too.
How can I use the client key with a phonegap app ?
Many thanks
I think Google Maps Javascript API v3 for work does not work on PhoneGap/Cordova, because the API refers the domain of the page.
You can still use Google Maps Web APIs (direction APIs, geocoding APIs ... etc) with your key.
Ask your Google Maps reseller (or directly Google support team).
I have an old website that uses Google maps v2. Previously the website was running under http://domain1.edu. Now it is runs under http://domain2.edu. It appears that I need to update the map key.
On the internet, I was looking for how to do this. I find incomplete info at Google's own website. Here is the link for v2 map key: https://developers.google.com/maps/documentation/javascript/v2/introduction?csw=1#Obtaining_Key
It says:
To create your API key, visit the APIs Console at https://code.google.com/apis/console and log in with your Google Account.
Click the Services link from the left-hand menu, then activate the Google Maps API v2 service.
Once the service has been activated, your API key is available from the API Access page, in the Simple API Access section. Maps API applications use the Key for browser apps
First, I am unable to find "Google Maps API v2" service mentioned above. I am able to find Google Maps API v3, and so I enabled it. I used the key mentioned at https://developers.google.com/maps/documentation/javascript/tutorial#api_key
However, the website key is still not working.
Here is the page with Google map: http://nmai.si.edu/nafvf/attend.aspx
Anyone knows how to fix this?
Thanks and regards!
You are using the deprecated Google Maps Javascript API v2, those keys are no longer available (as the documentation you point to indicates). You need to use a v3 key, and make sure you have the referrers set correctly for that key (you really should update your map to use the v3 API...)
working example (copied from Mike Williams' v2 tutorial, just changed the key)
This link says how to generate the key for android. You need to get the SHA1 of your signing key and then gotto google console to generate the key.