Services: Training Services | Consulting Services
To register for a Maps API Key, follow these steps:
1. If you don't have a Google account, use the link on the page to set one up.
2. Read the Android Maps API Terms of Service carefully. If you agree to the terms, indicate so using the checkbox on the screen.
3. Paste the MD5 certificate fingerprint of the certificate that you are registering into the appropriate form field.
4. Click "Generate API Key"
The server will handle your request, associating the fingerprint with your developer identity and generating a unique Maps API Key, and then will return a results page that gives you your Key string.
To use the Maps API Key string, copy and paste it into your code as described in the next section.
Note: If you happen to forget your Maps API Key, you can generate a fingerprint for your certificate and register it again. The registration server will give you the same Maps API Key for the specified certificate fingerprint.
Adding the Maps API Key to your Application
Once you've registered with the Google Maps service and have obtained a Maps API Key, you must add it to your application's MapView objects, so that the Maps server will allow them to download Maps tiles.
Now that you have the api key, you can use it in the main.xml layout file of your MapTest application. Here's what mine looks like:
<?xml version="1.0" encoding="utf-8"?>
Note: For MapView objects instantiated directly from code, pass the Maps API Key string as a parameter in the constructor. For example:
mMapView = new MapView(this, "example_Maps_ApiKey_String");
Final Steps to Enable MapView Elements
If you've added the Maps API Key to the MapViews in your application, here are the final steps to enable the MapView elements to run properly:
If you are developing in Eclipse/ADT (and have set up Keytool as described above), signing in debug mode is enabled by default. When you run or debug your application, ADT signs the .apk with the debug certificate, runs zipalign on the package, then installs it on the selected emulator or connected device. No specific action on your part is needed, provided ADT has access to Keytool.
Steve Robinson has been working in IT for over 20 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware.
In January 2013, I was awarded the prestigous 'IBM Champion' accolade.
IBM WebSphere Application Server 8.0 Administration Guide
WebSphere Application Server 7.0 Administration Guide
Contact | Articles | Shell Scripts | Java Code | JACL | Jython | WebSphere MQ | WebSphere Message Broker | WebSphere Blog | © Copyright 2006-2013 Robinson (UK) Limited