Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Google Maps API Key Before we begin working with Google Maps, we must obtain the Google Maps API key. Google provides detailed instructions for this here: http://code.google.com/android/add-ons/google-apis/mapkey.html The API key is based on the unique certificate that you generate when publishing your Android application. Because during the build and debug process, you use Eclipse’s debug certificate, you must first obtain a key that matches your debug certificate. This will allow your application to work correctly and display Google Maps data in the emulator, during testing. When you’re done with development, you’ll need to run through exactly the same process all over again, using your production certificate to generate the Maps API key. To get the MD5 hash of our certificate, necessary to generate the key, we first need to locate the full path of the keytool.exe file found within our Java JDK installation. The tool is available in one of the following locations: • • • C:\Program Files (x86)\Java\jdk<x.xxxxx>\bin\keytool.exe where <x.xxxx> is a version of the JDK you’re using. C:\Program Files\Java\jdk<x.xxxxx>\bin\keytool.exe where <x.xxxx> is a version of the JDK you’re using. keytool.exe in OS X is available from any location via Terminal. Next, locate your Eclipse certificate, in one of the following locations: • • • Windows Vista / 7: C:\Users\<user>\.android\debug.keystore where <user> is your username Windows XP: C:\Documents and Settings\<user>\.android\debug.keystore where <user> is your username OS X and Linux: ~/.android/debug.keystore For windows, I recommend that you create a batch file that looks like this: 1 "C:\Program Files (x86)\Java\jdk1.6.0_23\bin\keytool.exe" -list -alias androiddebugkey -keystore "C:\Users\alext\.android\debug.keystore" -storepass android -keypass android pause The areas highlighted in yellow represent the places that you need to adjust the paths based on your locations. You care review the batch file accompanying this lesson and modify it as necessary. For OS X and Linux users, simply open a Terminal window and type in the following command: keytool -list -alias androiddebugkey -keystore ~/.android/debug.keystore -storepass android -keypass android The results should look like this (OS X): or like this (Windows): 2 In either case, jot down the MD5 fingerprint that was generated for you. This is the information you need in order to obtain the API key. Now, visit http://code.google.com/android/maps-api-signup.html and login with your Google account credentials, if necessary. Accept the Google Terms of service, enter your MD5 fingerprint, and click Generate API Key. 3 Write down the data returned back to you: I like to copy and paste the data points from the above screen into a text document that I keep handy as part of my project. Please keep in mind that you’ll need to do this on every PC that you develop on, and repeat the process before distributing your application into the Android Marketplace. When generating the production API key, use the keystore that you created for your application when you exported it from Eclipse. 4