Android應用程式使用Google Map

來源:互聯網
上載者:User

1. 建立你的應用程式,使用google api庫

 

2. 在你的布局RelativeLayout中引入一個MapView類

 

3. 擷取MD5認證指紋

 用keytool產生認證(該工具在你的JDK bin目錄下):
        keytool -genkey -alias agps -keyalg RSA -keystore mykey
 說明:
         這裡-alias agps是表示產生的這個認證的別名叫agps,-keyalg RSA  指的是採用的RSA演算法,-keystore mykey是指密鑰庫的位置,如果沒有該參數,則認證預設產生到使用者目錄(比如C:/Users/xf.chen/.keystore)。斷行符號後會提示你輸入keystore password,一些個人資訊及組織資訊。

 用keytool -list查詢擷取到的MD5 fingerprint,比如:

 C:/Program Files/Java/jre6/bin>keytool -list
 輸入keystore密碼:

 Keystore 類型: JKS
 Keystore 提供者: SUN

 您的 keystore 包含 1 輸入

 agps, 2009-9-20, PrivateKeyEntry,
 認證指紋 (MD5): 3B:21:23:50:8E:****

4. 擷取MAP API KEY
在如下網頁註冊擷取MAP API KEY: http://code.google.com/android/maps-api-signup.html(需要有google帳號)

 

5. 填寫到main.xml中:

    <com.google.android.maps.MapView
        android:id="@+id/mapview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:clickable="true"
        android:apiKey="0hqzJey****"
    />

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.