Getting started with Android development: register a Google Map API key and display Google Maps

Source: Internet
Author: User

Register Google map API key

Cheungmine

Next, yesterday's topic, today we will first demonstrate how to generate a Google Android-certified fingerprint, which is used to register a Google Map API key. With this key, we can develop Android applications based on Google map APIs. For example, embed Google map in your own program. We will not discuss any legal licensing issues here. Suppose you can develop such an application for the purpose of learning.

Ensure that the Java environment is correctly installed and configured, and that the eclipse and Android sdks are correctly installed and configured. Then, in command line mode, enter the following command to ensure that the following command is entered in one line:

Keytool.exe-list-alias androiddebugkey-keystore "C:/Documents and Settings/Administrator/. Android/debug. keystore"-storepass Android-keypass android

The result is as follows:

 

Mark the text in the red box. This is your fingerprint. Make sure you have a Gmail account.

Http://code.google.com/intl/zh-CN/android/maps-api-signup.html

Enter your authentication fingerprint to obtain the apikey. The result is as follows:

 

 

The above section of XML is particularly useful. In the following example, I will demonstrate how to use it.

 

1) Open eclipse, choose Android SDK and AVD manager under the window menu, select a Virtual Machine (Virtual Devices), such as HTC-G7, press start, fill in 5 in screen size (in, launch. The following figure shows how our virtual G7 is opened:

 

 

2) Let's start our Google map journey. I cannot guarantee a success. Because I write this article and experiment programs, I cannot predict what will happen next when I write. All right, let alone eclipse-> file-> New-> Project-> Android project:

 

Press finish to end the project creation.

3) When I test the above project, I always tell me that the AVD device is not found, even though my HTC-G7 virtual machine has been turned on. So I turned off the HTC-G7 and ran the project above, still telling me that AVD was not found. I suddenly remembered that the avd I created yesterday was based on the standard android2.2. Today I am using Google map API. I need to recreate an AVD to support Google map API. So I opened the AVD Device Manager again. I created my 2nd AVD --- GMAP in the following format:

 

4) at this time, my 2nd avds, that is, avds supporting Google Map, were correctly created. I know that you also need to modify the configuration of mapsdemo, that is, find

Android: apikey, which adds the map key I just created. In fact, this sentence is in mapview. xml. If you do not know, it does not matter. Search for all files, find the location where Android: apikey appears, and add the key generated at the beginning of the article, for example:

In addition, you need to enter this key in the place where mapview needs to be created, continue searching for new mapview, and find

Mmapview = new mapview (this, "mapviewcompassdemo_dummyapikey ");

The result is as follows:

Mmapview = new mapview (this, "05ox3o9mak1mn-jvwtdv ................");

 

5) Compile and run the program and you will see the following results. Here there are two programs. You can choose any one to see if the results are similar:

 

 

 

Now, let's write it here today. Everything is fine. Although it is not involved in writing a line of real Java code. However, my small example finally has a result, and the next article is about to enter the topic, which will become more and more difficult. When I wrote my article today, I also Google the following article. But it does not seem suitable for my android2.2.

 

Http://westyi.javaeye.com/blog/714945

 

I have not actually written Java code, so I can only come here today. I can't say anything more. I hope you can correct it.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Related Article

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.