MapView的apiKey
来源:互联网 发布:淘宝行业发展趋势 编辑:程序博客网 时间:2024/06/08 06:58
我们在使用Google的地图API进行程序开发时,往往会使用com.google.android.maps.MapView。而使用com.google.android.maps.MapView又需要一个android:apiKey。本文将介绍如何申请和使用MapView的apiKey
一、找到debug.keystore
打开Eclipse--->Windows--->Preferences--->Android--->Build
查看默认的debug.keystore位置,我的是C:/Documents and Settings/Administrator/.android/debug.keystore
如果debug.keystore已经过期,请删除它,然后在Eclipse中编译一个Android工程,这时Eclipse将生产一个新的debug.keystore
二、取得keystore的MD5
在命令行,运行命令:keytool -list -alias androiddebugkey -keystore "C:/Documents and Settings/Administrator/.android/debug.keystore" -storepass android -keypass android
结果显示:
androiddebugkey, Sep 28, 2011, PrivateKeyEntry,
Certificate fingerprint (MD5): DF:59:A3:47:11:0A:DD:8F:0D:43:2A:06:5D:13:E8:98
这里DF:59:A3:47:11:0A:DD:8F:0D:43:2A:06:5D:13:E8:98就是我们所需要的MD5
注:keytool位于JAVA_HOME\bin目录下。
三、用MD5获得apiKey
打开http://code.google.com/intl/zh-CN/android/maps-api-signup.html
输入上面获得的MD5,填写自己的邮箱,然后会进入这样的一页:
Your key is:
00eTdGt9OWBDzzT0wQBPGYOnaS7pnd6dBj1bJjQ
This key is good for all apps signed with your certificate whose fingerprint is:
DF:59:A3:47:11:0A:DD:8F:0D:43:2A:06:5D:13:E8:98
Here is an example xml layout to get you started on your way to mapping glory:
<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="00eTdGt9OWBDzzT0wQBPGYOnaS7pnd6dBj1bJjQ"
/>
DF:59:A3:47:11:0A:DD:8F:0D:43:2A:06:5D:13:E8:98就是我们需要的MapView的apiKey.
注意:apiKey和你的证书是一一对应。这里的话,它其实是和debug.keystore中的这名叫androiddebugkey的公钥\私钥是一一对应的。
四、使用apiKey
可以在布局文件中或代码中使用apiKey.
示例1:
mapview.xml文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="00eTdGt9OWBDzzT0wQBPGYOnaS7pnd6dBj1bJjQ"
android:clickable="true"
android:focusable="true"
/>
</LinearLayout>
示例2:
mMapView = new MapView(this, "00eTdGt9OWBDzzT0wQBPGYOnaS7pnd6dBj1bJjQ");
- MapView的apiKey
- android 的mapview的apikey
- android 的mapview的apikey
- android 的mapview的apikey
- 申请 Android MapView 的apiKey流程
- 申请 Android MapView 的apiKey流程
- 如何申请Android MapView的apiKey
- 如何申请Android MapView的apiKey
- Android MapView 申请apiKey
- Android MapView 申请apiKey
- Android MapView 申请apiKey
- Android MapView 申请apiKey
- Android MapView 申请apiKey
- Android MapView 申请apiKey
- Android MapView 申请apiKey
- Android MapView 申请apiKey
- googlle MapView apiKey
- Android MapView 申请apiKey
- firefox 9 BEta 6已经发布
- 编译链接和加载
- LDD3 范例程序在新版本内核下的问题及解决办法(linux—2.6.38.8)
- python应用_根据图标提取分类应用程序
- VC 链接常见问题
- MapView的apiKey
- KBUILD系统原理分析
- Appscan---会话标识未更新
- 华为一道面试题,不能用系统的字符串函数求对等数,用最简单的方法实现。
- rsync服务器架设
- 静态成员函数
- ie6下CSS样式失效时如何进行调试
- LINQ to XML
- bash中for循环的一个特别写法