[Android] 使用Google API的前期準備

來源:互聯網
上載者:User
一、緣起    最近需要使用Google OAuth和Google Map,在使用Google的這些服務之前,有一些相同的準備工作要做。    這些工作包括:安裝Google Play Services,產生認證指紋,建立Client ID     二、安裝Google Play Services    Google Map的API被整合在Google Play Services包中了,這個包可以使用Android Sdk Manager下載,位置:Extras->Google Play Services。     三、簽署憑證指紋    使用Google的服務,首先,需要將Android的簽署憑證進行SHA加密,然後,把這個結果在Google那邊註冊。    Android在Debug簽署憑證和發布簽署憑證是不同的,不同機器上面Android的Debug簽署憑證也是不同的,因此,實際開發中,同一個項目往往需要生產多個指紋,並且在Google那邊註冊這些指紋。    下面給出Debug簽署憑證指紋的產生流程:    首先,找到Debug key的路徑。Preference->Android->Build->Default debug keystore        然後,運行命令 keytool -list -alias androiddebugkey -v -keystore "FULL PATH OF YOUR debug.keystore FILE" -storepass android -keypass android,其中FULL PATH OF YOUR debug.keystore FILE,要替換為Debug Key的路徑。得到結果如下所示,對於Google
OAuth1是需要MD5,在出了OAuth2之後,改用SHA1了,這裡僅僅需要SHA1的加密結果。     四、申請Client ID        開啟網址:https://code.google.com/apis/console/,沒有項目的話,首先要註冊一個項目,然後給該項目申請一個Client ID。    申請Client ID的時候,需要填寫簽署憑證指紋和Android程式的包名,如所示:        得到結果如所示,這樣指定包名和簽名對應的Android程式就能夠使用Google的API了。。     5. 參考資料       http://www.cnblogs.com/lanbaoer/archive/2013/01/09/2851672.html    https://developers.google.com/maps/documentation/android/start#installing_the_google_maps_android_v2_api
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.