90 likes | 417 Views
Google Maps (1). Chien -Chung Shen CIS, UD cshen@cis.udel.edu. About Google Maps API v1. From https://developers.google.com/maps/documentation/android/v1/hello- mapview :
E N D
Google Maps (1) Chien-Chung Shen CIS, UD cshen@cis.udel.edu
About Google Maps API v1 • From https://developers.google.com/maps/documentation/android/v1/hello-mapview: “Version 1 of the Google Maps Android API has been officially deprecated as of December 3rd, 2012. This means that from March 18th, 2013 you will no longer be able to request an API key for this version. No new features will be added to Google Maps Android API v1. However, apps using v1 will continue to work on devices. Existing and new developers are encouraged to use Google Maps Android API v2.”
Add Google Play Services (1) • Open Android SDK Manager and install Extras>Google Play services • Downloaded to <ADT-path>/sdk/extras/google/google_play_services
Add Google Play Services (2) • Add Google Play Services as an Android library project: select File >Import > Android > Existing Android Code into Workspace and enter <ADT-path>/extras/google/google_play_services/libproject/google-play-services_lib, and click Finish • Define library dependency by adding android.library.reference.1=../google-play-services_lib into file project.properties • Select Project > Properties, select Java Build Path, and navigate to Libraries • Select Add External Jars, highlight the following jar file, and click Open: <ADT-path>/extras/android/support/v4/android-support-v4.jar
Get Google Map Key (1) • To useGoogle Maps, we need a valid Google Maps API key • Get the key via Google APIs Console with • application signature key (SHA-1) • application package name • Use the Android debug key (~/.android/debug.keystore) to create the signature (SHA-1) keyby running keytool-list -v -alias androiddebugkey –keystoredebug.keystore -storepass android -keypass android
Get Google Map Key (2) • Register with Google APIs Console • Activate “Google Maps Android API v2”
Get Google Map Key (3) • Create API key by clicking “API Access” • Click on “Create new Android key”
Get Google Map Key (4) • Enter SHA-1 fingerprint and the application package name separated by a semicolon (;) and click Create to get the API key
AndroidManifest.xmlFile • Insert API key into AndroidManifest.xml <meta-data android:name="com.google.android.maps.v2.API_KEY"android:value="your_apikey" />