2013-12-19 58 views

回答

2

您使用了一個描述Google API舊界面的舊教程。 在新的UI,你需要做以下(source):

爲了獲得API密鑰:

1. In the sidebar on the left, select APIs & auth > Registered apps. 
2. Click Register app. 
3. In the Name field, type your app's name. 
4. Click Android > Accessing APIs directly from Android. 
5. Under Android identification, type the package name for your app. 
6. Enter an SHA1 fingerprint. To get this value, follow the instructions in the 
    console help. 
7. Click Register. 
8. In the new page, open the Android Key section and copy the API key. You will 
    need the API key later on to perform authentication in your application server. 

注意:如果你需要旋轉鍵,單擊「循環鍵」圖標。將創建一個新的密鑰 。如果您認爲密鑰已被盜用 並且您希望立即將其刪除,則可以通過 從控制檯中刪除該應用來完成此操作。然後使用相同的SHA1和軟件包名稱爲應用程序 創建一個新條目。

要獲得第6步中SHA1指紋,你可以使用命令:

keytool -exportcert -alias androiddebugkey -keystore C:\Users\myusername\.android\debug.keystore -list -v

(然後在提示符下輸入默認密碼android

+0

我也按照這些步驟操作,但我沒有在API和授權部分下看到已註冊的應用程序。那實際上在哪裏? –

+0

@BarcelonaTsandesh查看屏幕截圖[here](http://stackoverflow.com/questions/20677709/issue-with-registration-app-in-gcm/20683976#20683976) – Eran

+0

@BarcelonaTsandesh他們再次改變了API。現在你必須點擊'APIs&auth'>'Credentials'來創建API密鑰。 – Eran

1

您可以通過訪問https://cloud.google.com/console來生成API密鑰。 您需要爲Google Cloud Messaging Service激活api。

此外還有限制IP地址連接到您的api的規定。你的IP地址是默認提供的。您可能需要使用上述教程刪除它才能使用GCM。

如需更多幫助:檢查this

1

嘗試訪問該鏈接不重定向到新的雲GCM。此鏈接將重定向到新的谷歌可能,但您需要點擊返回選項來查看API訪問菜單。您將會看到類似的消息歡迎使用新的Google Developers Console!喜歡舊的控制檯?回去|關閉

+0

+1,谷歌一直對重定向我到新的雲端GCM。我將此鏈接加入https://code.google.com/apis/console/b/0/?noredirect並停止重定向 – fedmich