Android Map New usage: mapfragment app

Source: Internet
Author: User

Mapview, mapactivity This limitation is that you must inherit mapactivity, otherwise you cannot use Mapview, but the limitation of mapfragment is that you must install the Google Play Service, This means that it must be a native ROM. And the SDK will be above 12.

1.MapView, mapactivity This limitation is that you must inherit mapactivity, otherwise you cannot use Mapview. This is where the tangle lies. However, the latest official online has abandoned the dregs of the mapactivity.
Version 1 of the Google Maps Android API as been officially deprecated as of December 3rd, 2012. This means the from March 3rd, the you'll no longer is able to request a API key for this version. No new features would be added to Google Maps Android API v1. However, apps using V1 would continue to work on devices. Existing and new developers is encouraged to use Google Maps Android API v2.
2.MapFragment This limitation is that the Google Play Service must be installed, that is, the native ROM must be. And the SDK should be above 12. I have a sore egg.
3.WebView seems to be easy to integrate in, but no practice on wood has a say.
The first way I skipped it first. We all know that. Say the second kind, the third one will
Mapfragment is just out of the Google official package, to integrate in or is quite troublesome. Website Link Https://developers.google.com/maps/documentation/android/start
Start by adding API access permissions to Google Conlose, get Apikey, create a project, and then go to the services to open the Google Maps Android API v2 to the API Access puts your project's KeyStore SHA1 and package name in and gets the unique API key
Open SDK manager--install android support Libaray and Google Play services in extras, both Lib and Samples Sdk_path/extra/google/google_ Under the play_services. Import.. /lib_project as the libaray of his project
After this step is done, add the permissions and API key to the Manifest.xml file. The code is as follows

<permissionandroid:name="com.example.permission.MAPS_RECEIVE"  Android:protectionlevel="signature"

Com.example Replace with your project's package

<uses-permission android:name="Com.example.permission.MAPS_RECEIVE"/><uses-permission android:name="Android.permission.WRITE_EXTERNAL_STORAGE"/><uses-permission android:name="Android.permission.INTERNET"/><uses-permission android:name="Com.google.android.providers.gsf.permission.READ_GSERVICES"/><!--My location--><uses-permission android:name="Android.permission.ACCESS_COARSE_LOCATION"/><uses-permission android:name="Android.permission.ACCESS_FINE_LOCATION"/><!--Maps API needs OpenGL ES2.0.--><uses-featureandroid:glesversion="0x00020000"android:required="true"/>

Put it in the application statement.

<meta-dataandroid:name="com.google.android.maps.v2.API_KEY"android: Value="appkey"

Add the Mapfragment declaration to the layout XML

<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.MapFragment "

Android Map New usage: mapfragment app

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.