Basic Process of applying Google map to Android apps

Source: Internet
Author: User

 

Before use

Google Maps bring great convenience to people's lives. For example, Google maps can be used to search for merchant information, view maps, and obtain vehicle routes. The Android platform also provides a map package (COM. Google. Android. Maps), where mapview allows you to conveniently program using Google map resources. Make the following necessary settings before use.

(1) Add maps. jar to the Project

In the android SDK, map-related APIs are provided in the form of a jar library, which is in the directory of "Android-SDK-Windows \ add-ons \ google_apis-4. To add maps. jar to a project, you can specify the target containing Google API in the "android" column of the Project attribute as the project building target.

(2) embedding a map into an application

By using the mapactivity and mapview controls, you can easily embed a map into an application. In this step, you need to add the Google API to the build path. Select "Java build path" on the page shown in Figure 12-4, select Google API in target, and set the project to contain Google API

(3) obtain the map API key

Before using mapview, you must apply for an android map API key as follows.

Step 2: Find Your Debug. keystore file, which is usually located in the following directory.

C: \ Documents and Settings \ your current user \ Local Settings \ Application Data \ android

Step 2: Obtain the MD5 fingerprint. Run cmd.exe and run the following command to obtain the MD5 fingerprint.

> Keytool-list-alias androiddebugkey-keystore "Debug. keystore path"-storepass Android-keypass android

For example, enter the following command.

Keytool-list-alias androiddebugkey-keystore "C: \ Documents and Settings \ Administrator \. Android \ Debug. keystore"-storepass Android-keypass android

At this time, the system will prompt you to enter the keystore password, and then enter Android, the system will output the Requested MD5 authentication fingerprint

Step 2: apply for the API key of Android map.

Open your browser and enter the URL: http://code.google.com/intl/zh-cn/ Android/maps-API-signup. html

On the Google Android map API key application page, enter the MD5 fingerprint obtained in Figure 12-6 and press the "generate API key" button to go to the following figure, obtain the applied API key

At this point, an API key is obtained successfully, and the entire preparation before programming is completed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.