Getting the Google Maps Android API V2 is now upgraded to V3 by Google map API. V2 is popular. V1 has been marked as obsolete.
The Demo code is located in SDK extras/Google/google_play_services/samples/maps
Google Code
Console address
- First download the Google Play Service SDK. Download Android SDK
- The API key obtained is different from that obtained by V1. Note:
- Application manifest settings
Google says Note:
Google Maps Android API V2 uses a new system of managing keys. existing keys from a Google Maps Android V1 application, commonly known as mapview, will not work with the V2 API. the key systems of generation 2 and generation 2 are different and not universal.
keytool -v -list -keystore key.keystore
Copy the sha1 fingerprint
On the left side of the console, click API access. Create new Android key at the bottom of the page. Copy the fingerprint. Note that the format is "fingerprint; package name"
Then create the following
Then you get the API key.
Next, go to mainfest. xml.
<Meta-data Android: Name = "com. google. android. maps. v2.api _ key "Android: value =" your_api_key "/> Add required permissions to <permission Android: Name =" com. example. mapdemo. permission. maps_receive "Android: protectionlevel =" signature "/> <uses-Permission Android: Name =" com. example. mapdemo. permission. maps_receive "/> <uses-Permission Android: Name =" android. permission. internet "/> <uses-Permission Android: Name =" android. permission. W Rite_external_storage "/> <uses-Permission Android: Name =" com. google. android. providers. GSF. permission. read_gservices "/> <uses-Permission Android: Name =" android. permission. access_coarse_location "/> <uses-Permission Android: Name =" android. permission. access_fine_location "/> V2 requires OpenGL. Therefore, add the <uses-feature Android: glesversion =" 0x00020000 "Android: required =" true "/> XML Sample Code <? XML version = "1.0" encoding = "UTF-8"?> <Fragment xmlns: Android = "http://schemas.android.com/apk/res/android" Android: Id = "@ + ID/Map" Android: layout_width = "match_parent" Android: layout_height = "match_parent" class = "com. google. android. GMS. maps. mapfragment "/>