Can I have a single Google Maps API key for all my apps without registering their package names?

北战南征 提交于 2019-12-17 18:34:51

问题


I have written an android library project that includes custom MapFragments, based on Google Maps for Android v2 API. In the Google APIs console, I have registered the library's package name with my debug/signed certificates.

I need to create various apps that use this library as common code base and I was wondering if there is a way to still use the MapFragments of the library, without having to add each app's package name in the Google APIs console. I need this because I want to automate app creation (with Jenkins) and I don't want any manual steps, like logging in to the APIs console and registering the package name.

So far, I haven't managed to find a way to do this. Wildcards don't work (e.g. having com.mycompany.* as package name in the console), and if I don't explicitly register each app's package name, the map doesn't load.

Is it possible to somehow make the MapFragments look up the library's single api key/package, instead of the app's?


回答1:


Here's how to accomplish what you're trying to do when creating a new API key:

  • Click create new Android key button
  • Don't enter anything into the package names list
  • Click create

Then you should see AndroidApps: Any app allowed, and be able to use that maps API key in all of your apps without any configuration on the APIs console.

Since you have probably already have entered the certificate fingerprints for each of your applications, just click Edit allowed Android apps, delete them all from the list, click update, and it should say any app is allowed to use that API key.




回答2:


It can answer for 2 ways

Can I have a single Google Maps API key for all my apps?

Yes, you can by register API Key with multiple lines by using enter, like this:

but for this question Can I have a single Google Maps API key for all my apps without registering their package names?

No, you can't

*edit image for easier to read




回答3:


There is no way to do that. Registering takes like 15 seconds per app if you use the same key for all of them.




回答4:


No... you have to specify package name. It identify your application registered with Map key



来源:https://stackoverflow.com/questions/16233442/can-i-have-a-single-google-maps-api-key-for-all-my-apps-without-registering-thei

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!