Register for a Maps API Key if your application is using Map View elements

For complete information about getting a Maps API Key, see Obtaining a Maps API Key.

If your application uses one or more Mapview elements, you will need to register your application with the Google Maps service and obtain a Maps API Key, before your MapView(s) will be able to retrieve data from Google Maps. To do so, you supply an MD5 fingerprint of your signer certificate to the Maps service.

During development, you can get a temporary Maps API Key by registering the debug key generated by the SDK tools. However, before publishing your application, you must register for a new Maps API Key that is based on your private key.

If your application uses MapView elements, the important points to understand are:

1. You must obtain the Maps API Key before you compile your application for release, because you must add the Key to a special attribute in each MapView element — android:apiKey — in your application's layout files. If you are instantiating MapView objects directly from code, you must pass the Maps API Key as a parameter in the constructor.

2. The Maps API Key referenced by your application's MapView elements must be registered (in Google Maps) to the certificate used to sign the application. This is particularly important when publishing your application — your MapView elements must reference a Key that is registered to the release certificate that you will use to sign your application.

3. If you previously got a temporary Maps API Key by registering the debug certificate generated by the SDK tools, you must remember to obtain a new Maps API Key by registering your release certificate. You must then remember to change the MapView elements to reference the new Key, rather than the Key associated with the debug certificate. If you do not do so, your MapView elements will not have permission to download Maps data.

4. If you change the private key that you will use to sign your application, you must remember to obtain a new Maps API Key from the Google Maps service. If you do not get a new Maps API Key and apply it to all MapView elements, any MapView elements referencing the old Key will not have permission to download Maps data.

0 0

Post a comment