Android Google Map (101)
1、Install the Google APIs add-on in Eclipse
2、Android Project
- Manifest (AndroidManifest.xml)
- com.google.android.maps (a child of <application> element)
- <uses-library android:name="com.google.android.maps"/>
- android.permission.INTERNET (a child of <manifest> element)
- <uses-permission android:name="android.permission.INTERNET"/>
- @android:style/Theme.NoTitleBar
- <activity android:name=".HelloGoogleMaps" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar">
- res/layout/mapview.xml
- <?xml version="1.0" encoding="utf-8"?>
- <com.google.android.maps.MapView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/mapview"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:clickable="true"
- android:apiKey="Your Maps API Key goes here"
- />
- extends MapActivity
- create a object of MapView
- setBuiltInZoomControls(true)
- override isRouteDisplayed()
3、Obtaining a Maps API Key
- debug
- ~/.android/debug.keystore
- keytool -list -alias androiddebugkey -keystore <path_to_debug_keystore>.keystore -storepass android -keypass android
- release
- keytool -list -alias alias_name -keystore my-release-key.keystore
- https://developers.google.com/android/maps-api-signup
- Use Certificate fingerprint (MD5) to get Map API
沒有留言:
張貼留言