针对不同的android应用程序使用一个Google Maps API密钥

针对不同的android应用程序使用一个Google Maps API密钥

问题描述:

我刚刚生成了Google Maps API密钥,以便在我的Android应用程序中使用。我必须为应用程序提供SHA-1指纹和包名称。它看起来像这样:

I just generated the Google Maps API key to use in my android app. I had to provide the SHA-1 fingerprint and the package name for the application. It looked something like this:

BB:0D:AC:74:D3:21:E1:43:67:71:9B:62:91:AF:A1:66:6E:44:5D:75;com.example.android.mapexample

正如您所看到的,我必须提供应用程序的包名称。所以,这是否意味着我需要为不同的应用程序获得不同的API密钥?

As you can see I had to provide the package name for the app. So, does this mean that I need to get a different API key for different applications?

PS:奇怪的是,Google为SHA-1生成了两个API密钥,我输入的包名称组合。这是正常的吗?所以,我应该使用哪一个?

PS: Curiously, somehow, Google generated two API keys for the SHA-1 and package name combination I entered. Is this normal? And so, which one should I use?

对于不同的应用程序,您可以使用相同的密钥库和API密钥。 p>

You can use the same keystore and the API key for different applications.


  1. 使用相同的密钥为应用程序签名。

  2. 在控制台页面中为每个应用程序添加一行。
  1. Use the same key to sign your apps.
  2. Add a line for each application in the Console page.

所以,像这样:


BB:0D:AC:74:D3:21:E1:43:67:71:9B:62:91:AF:A1:66:6E:44:5D:75;com.example.android.mapexample
BB:0D:AC:74:D3:21:E1:43:67:71:9B:62:91:AF:A1:66:6E:44:5D:75;com.example.android.anotherapp
BB:0D:AC:74:D3:21:E1:43:67:71:9B:62:91:AF:A1:66:6E:44:5D:75;com.example.temp.lastapp

现在,您可以在所有这些应用中使用相同的API密钥。

And now, you can use the same API key with all these apps.