Transcript Google Maps

Android Google Maps
建國科技大學 資管系
饒瑞佶
2011/1
Google Maps
• 取得Google Map API
Step1:先進入JDK目錄
Google Maps
• 透過keytool.exe建立認證指紋
• 需要debug_keystore路徑
Google Maps
• debug_keystore路徑
Google Maps
• 輸入keytool –list –alias androiddebugkey –
keystore “C:\Documents and
Settings\Administrator\.android\debug.keystore”
–storepass android –keypass android
Google Maps
• 產生認證指紋
Google Maps
• 進入Google Map API Key申請頁面
• http://code.google.com/intl/zh-Tw/android/addons/google-apis/maps-api-signup.html
輸入認證指紋碼
Google Maps
• 進入Google Map API Key申請頁面
• http://code.google.com/intl/zh-Tw/android/addons/google-apis/maps-api-signup.html
Google Maps
• 產生出API金鑰
0O7bGO2vQxBc90bpYbJ8PnSjJapePPkrSGRvP3
A
加入main.xml
<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0O7bGO2vQxBc90bpYbJ8PnSj
JapePPkrSGRvP3A" />
Google Maps
main.xml
Google Maps
• 建立新專案: HelloMaps
沒有Google APIs target
Google Maps
• 如果沒有Google APIs target
• 請選擇Available packages進行安裝
Google Maps
• 安裝完Google APIs target畫面
Google Maps
• 建立新專案:
HelloMaps
顯示Google Maps地圖
加入
改成MapActivity
加入
Google Maps
• AVD也要對應具備Google APIs功能
Google Maps
• 增加 <uses-permission
android:name="android.permission.INTERNET" />
• 在 <application> 裡頭增加 <uses-library
android:name="com.google.android.maps" /> 資訊
Google Maps
不用註冊Google Maps API也可以
使用Intent
利用Intent 玩Google Maps
• 建立新專案:
IntentMaps
顯示Google Maps地圖
利用Intent 玩Google Maps
• AVD也要對應具備Google APIs功能
利用Intent 玩Google Maps
• 增加 <uses-permission
android:name="android.permission.INTERNET" />
利用Intent 玩Google Maps
更多Google Maps
• 更多Google Maps