Google Map API

1.首先找到debug keystore路径:

打开Eclipse—>Windows—>Preferences—>Android—>Build, 一般是这样的路径 C:\Users\Administrator\.android\debug.keystore

2、在cmd执行命令获取认证指纹 (MD5):

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Ava>keytool -list -alias androiddebugkey -keystore "C:\Users\Ava\.andro
id\debug.keystore" -storepass android -keypass android
androiddebugkey, 03-Jul-2012, PrivateKeyEntry,
Certificate fingerprint (MD5): 15:D4:A6:05:4D:CE:9F:A3:D6:A3:51:31:BC:5D:D1:9C

3. 获得key需要一个google账号:

https://developers.google.com/maps/documentation/android/maps-api-signup

Your key is:

0OSF67gdTwVdrKOMErmwc4yVFUzC_vFQKkzcwCg

This key will work for all apps signed with your certificate whose fingerprint is:

AF:95:79:AB:D8:11:2A:09:D5:AB:87:76:BD:92:8E:C8

Here is a sample 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="0OSF67gdTwVdrKOMErmwc4yVFUzC_vFQKkzcwCg"
                 />
4. 在android的布局文件里,直接使用上面的示例,就可以使用google map 组件了。
5. 在AndroidManifest.xml中将
<uses-library Android:name="com.google.android.maps" />
放在<application>里面,下面两行可选放activity之后:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
6. mapTest.java

public class mapTest extends MapActivity {
/** Called when the activity is first created. */
private MapView myMapView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_opcv);}

?why still blank screen?为什么是空白地图?

  1. 没有使用自己的map api key
  2. 未设置地图中心和缩放级别(一般为10比较好):

map.getController().setCenter(new GeoPoint(39971036,116314659));//设置地图中心
map.getController().setZoom(10);//设置缩放级别

via http://blog.sina.com.cn/s/blog_682139d00100q0wa.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

生活在西班牙

自己动手丰衣足食

BlueAsteroid

Just another WordPress.com site

Jing's Blog

Just another WordPress.com site

Start from here......

我的心情魔方

天才遠私廚

希望能做一個分享各種資訊的好地方

语义噪声

西瓜大丸子汤的博客

笑对人生,傲立寰宇

Just another WordPress.com site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision

datarazzi

Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness

槑烎

1,2,∞

Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web

%d bloggers like this: