简体   繁体   中英

basic android google map development

After I acquire an apiKey from Google, according to development document, if I use MapFragment, a map shows up , but if I use MapView, I get this error from the server:

IOException processing: 26          
java.io.IOException: Server returned: 3

Then I see someone in the forum said that, in order to use MapView, this app must be downloaded from google play. So,

  1. I wonder how developers use MapView to develop?

  2. What's the difference between MapView and MapFragment?

  3. Does the google map depends on google play service?

Developer use MapView must forward all the activity life cycle methods - such as onCreate(), onDestroy(), onResume(), and onPause() - to the corresponding methods in the MapView class.

MapFragment is a subclass of the Android Fragment class, allows you to place a map in an Android fragment. MapFragment objects act as containers for the map, and provide access to the GoogleMap object. Unlike a View, a Fragment represents a behavior or a portion of user interface in an activity. You can combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities.

MapView is a subclass of the Android View class, allows you to place a map in an Android View. A View represents a rectangular region of the screen, and is a fundamental building block for Android applications and widgets. Much like a MapFragment, the MapView acts as a container for the map, exposing core map functionality through the GoogleMap object.

The Google Maps Android API v2 is distributed as part of the Google Play services SDK. You can download the Google Play services SDK via the Android SDK Manager.

For detailed instructions, see the Google Play services documentation. Here is a summary of the steps you will need to take:

  • Install the Google Play services SDK.
  • Add Google Play services as an Android library project.
  • Reference the Google Play services in your app's project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM