Simple positioning of Android Google Maps (1)

Source: Internet
Author: User

After reading this article, please go to the workshop

This article is just a simple process of writing a simple Google Map, and simply downloads a world map. I hope Android users will like it. However, just getting started ~~~ Thank you for your suggestions ~~~

1. working directory problem: when working on a Google Map Project, remember to put the myeclipse working directory and your own SDK (Android-SDK-Windows Folder) in the same directory;

2. Open SDK manager to install Android support library, Google Play services, and Google market billing Google market licensing in extras ;,

3. Introduce the google-play-services_lib project to myeclipse (file-import-Android-existing Android code into workspace browse to the corresponding directory of the SDK project );

4. Create a project and select the SDK with Google API. The Work Package of the project you created must correspond to the API key you applied;

Note: if notApply for Google Maps API key (for development and debug), see http://blog.csdn.net/woshishuoshuoa/article/details/9774491

5. Add it to the manifest of the new project.

A. Add the following sub-tags to the application:

<Meta-data Android: Name = "com. Google. Android. Maps. v2.api _ key" Android: value = "your own apikey"/>

B. Add the following content to the mainifest and Tag:
<Uses-Permission
Android: Name = "android. Permission. Internet"/>
<Uses-Permission Android: Name = "android. Permission. access_network_state"/>
<Uses-Permission Android: Name = "android. Permission. write_external_storage"/>
<Uses-Permission Android: Name = "com. Google. Android. providers. GSF. Permission. read_gservices"/>
<! -- The following two permissions are not required to use Google Maps Android API V2, but are recommended. -->
<Uses-Permission Android: Name = "android. Permission. access_coarse_location"/>
<Uses-Permission Android: Name = "android. Permission. access_fine_location"/>
<! -- OpenGL ES -->
<Uses-feature
Android: glesversion = "0x00020000" Android: required = "true"/>

6. Open activity_main.xml.
Clear the content
Enter:
<? XML version = "1.0" encoding = "UTF-8"?>
<Fragment xmlns: Android = "http://schemas.android.com/apk/res/android"
Android: Id = "@ + ID/Map"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Class = "com. Google. Android. GMS. Maps. supportmapfragment"/>;

7. Open the activity and modify the inheritance mainactivity extends fragmentactivity;

, 8, introduced google-play-services_lib:

Right-click your project, select proprties-> left, select Android, in the right library column, click Add browse to google-play-services_lib
Click Apply for this project.

Note: Do not select "is library". Before running the project, you must install Google Play services and Google Play store on your Android phone.

This small case simply familiarizes everyone with the android Google Maps development process. It is simple, just getting a map of the world... Will be updated continuously ~~~~

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.