申請google android map api key
文章内容如下:

the mapview class in the maps external library lets you integrate google maps into your application. becausemapview gives you access to google maps data, you must register with the google maps service before your implementation of mapview will be able to obtain map data.
registering and using a maps api key is free and has two parts:
first you register the md5 fingerprint of the certificate that will be used to sign your application. the maps registration service then provides a maps api key that is associated with your application's signer certificate.
then you add a reference to this maps api key in each mapview. you can use the same maps api key for any mapview in any android application, provided that the application is signed with the certificate whose fingerprint you registered with the service.
to keep things simple we shall register using the debug certificate associated with our development machine to obtain a temporary maps api key. this is adequate for demonstration and development. however, when you publish an app (e.g., deployment through the android market) you must digitally sign it and (if you employ google maps) before you publish your application you must register for a new key based on your release certificate, and update the references in your mapviews to this new key.
to generate an md5 fingerprint of the sdk debug certificate, we must first locate the debug keystore. this will depend on the platform in use. for example, some standard locations are
windows vista: c:\users\\.android\debug.keystore
windows xp: c:\documents and settings\\.android\debug.keystore
linux and mac os x: ~/.android/debug.keystore
if in doubt, you can locate the debug keystore by using eclipse and choosing window > preferences > android > build.
once you have located the keystore, the following command issued at a shell prompt will return the md5 fingerprint of the debug certificate:
for example, on one of my linux systems (named m33) i obtained
you must have a (free) google account to use the maps service. if you don't have one already, use the link on the page to sign up for one.
agree to the terms of service by clicking the checkbox.
paste into the appropriate form field the md5 certificate fingerprint that you generated above for the certificate that you are registering.
click "generate api key".
the server will return a page similar to the following figure containing your key string.
keep the key string in a safe place because you will need it for any mapping application that you write. in the next section we will describe how to use this key.
you must add the maps api key obtained above to any mapview objects in your application, so that the maps server will allow them to download map tiles. for mapviews declared in xml files, the key is added as the value of a special android:apikey attribute. for example, the maps api key returned when the md5 key for m33 obtained above was registered is
thus a mapview on the machine m33 can be registered to receive map data in an application running under the debug certificate by inserting
in the xml layout file for the mapview.
this maps api key is valid only under the debug certificate on a specific machine (m33 in this example), for as long as that debug certificate is valid.
if i transfer the application to another machine, i will have to obtain a map key for that machine in the same way as described above and change the android:apikeyattribute accordingly.
also, each mapview within an application must have its own android:apikeyspecification (but you can use the same api key for all).
the reason that all of this seems more involved than it needs to be is basically that google maps are compatible with the android api, but they are licensed separately from android.
if you instantiate mapview objects directly from code rather than laying out with xml, the maps api key string is passed as a parameter in the constructor. for example, assuming the same api key as above,
would register mymapview to receive mapping data.
finally, for your application to use the maps api key you must declare in the androidmanifest.xml file that it requires permission to access the internet and that it uses the google maps library. the first requires an element
while the second requires an entry
that is a child node of the <application> element. for example,
</manifest>
歡迎加群互相學習,共同進步。qq群:ios: 58099570 | android: 330987132 | go:217696290 | python:336880185 | 做人要厚道,轉載請注明出處!http://www.cnblogs.com/sunshine-anycall/archive/2011/09/16/2178227.html