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****" />