Apikey of mapview for Android

Source: Internet
Author: User

My first map program was written in Android SDK 1.0. At that time, apikey was just released. At that time, I applied for a map resource on the simulator and mobile phone, as a result, when I switched to Android SDK 1.5, I could run it on my mobile phone, but I couldn't do it on the simulator. So this problem has been bothering me. I checked some information on the Internet, one of the most trustable answers is that the map resources are turned off on the simulator, so I always think this is the case. At that time, because my company only had one to do map-related development, later, when talking with developers from other companies, I found that the map resources can be displayed on the simulator, and I am very depressed. I don't know why, because my program and configuration have never been a problem, how can the map be rolled over? After a long time, I suspect that my apikey has expired. As a result, I applied for a new one, sure enough, the map came out, and finally thought about it. It is true that when each version is updated, you should apply for an apikey again and write it here for your reference so as not to make the same mistake again.

 

**************************************** **********************************

 

The following describes how to apply for an apikey:

1. Find Debug. keystore:

Open eclipse ---> Windows ---> preferences ---> Android ---> build
Check the default debug keystore location. my options are C:/Documents and Settings/Administrator/. Android/debug. keystore.

2. Run CMD and enter the command: keytool-list-alias androiddebugkey-keystore "C:/Documents and Settings/Administrator/. Android/debug. keystore"-storepass Android-keypass android

The output is androiddebugkey, 2010-4-20, privatekeyentry,
Authentication fingerprint (MD5): da: 29: 11: 13: D2: D2: 0f: 87: 8e: 08: 22: 6C: 0d: 4d: 51: 30

3. Open http://code.google.com/intl/zh-CN/android/maps-api-signup.html

Enter the MD5 obtained above, enter your mailbox in order, and obtain

<Com. Google. Android. Maps. mapview
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
Android: apikey = "*******************************"
/>

This apikey is what you want.

4. Configure mapview in the XML file of your application settings:


<Com. Google. Android. Maps. mapview Android: Id = "@ + ID/Map"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
Android: apikey = "************************************* ********"
Android: clickable = "true"
Android: focusable = "true"
Android: nextfocusdown = "@ + ID/Map"
Android: nextfocusleft = "@ + ID/Map"
Android: nextfocusright = "@ + ID/Map"
Android: nextfocusup = "@ + ID/Map"
/>
Everything is OK, so the map will come out.

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.