Android add-ons

Source: Internet
Author: User
Android add-ons

This article only analyzes add-ons on Android 1.5 cupcake and 1.6 donut platforms.

Android add-ons is an optional API in Android. Google, like sun, uses some high-end applications as optional APIs for mobile phone manufacturers to customize different hardware support modules. In jme, Sun was published as JSR, while Google adopted the add-ons API.

1. Development SDK
Starting from 1.5, Google release's Android version will split some of Google's special services and integrate them into add-ons, map the compiled library in the add-ons \ google_apis-3 \ libs directory. jar, We Can decompile them to see some "inside ".
Therefore, if you want to apply add-ons to your application, you must select build target as 3 (sdk1.5 cupcake) when creating an Eclipse project ), or 4 (sdk1.6 donut)

In this way, our program can import the class in add-ons and use the method in it.

Ii. device Runtime Library
2.1 emulator (simulator)
To install and run a program containing the add-ons API, you must create an AVD (Android Virtual Device) with a target ID of 3 or 4)
For example:
Android create AVD-N googleaddons-T 3 (1.5 and 1.6) or
Android create AVD-N googleaddons-T 4 (applicable only to 1.6)
After AVD is started, we can see more content in system/framework and system./etc/permissions.

Yes, this is the running library of the add-ons program on the device (files in Dex format are optimized ).

2.2 target (Mobile Terminal)
As a manufacturer of mobile terminals that cooperate with Google
If you want to integrate Google applications such as map, market, Picasa, and sync on your android terminal, you need to sign a contract with Google, in this way, Google will have a dedicated person to help you integrate this series of services into your platform.
As a manufacturer of mobile terminals that do not work with Google
We can use the method of cracking to integrate the Runtime Library in add-ons into our own framework (build to the system. IMG of the mobile terminal ).
The procedure is as follows:
1. in Android, Google add-ons (Google Maps) is supported. You need to extract the following files (pull from the standard SDK or pull from gphone) package it into system. IMG
Google add-ons only requires 1--2
Goolge maps (Google Map Program) requires 1--5

1) system/framework com. Google. Android. Maps. Jar
2) system/etc/permissions com. Google. Android. Maps. xml
3) system/framework com. Google. Android. gtalkservice. Jar
4) system/etc/permissions com. Google. Android. gtalkservice. xml
5 system/APP maps.apk (Google Maps V3.0)

2. Source Code: Android cupcake release (tested and applicable to the donut platform as well .)
1) Compile the source code (to generate the most primitive Android content in the out/target directory)
2) Add the above files to the out/target/product/Generic Directory, and use make Snod to package the files in the source code root directory to obtain the new system. img

Iii. Common class parsing In SDK
See add-ons \ google_apis-4 \ docs \ reference \ index.html In the SDK

3.1 What functions can we implement using Add-ons?
1. mapactivity-manage the lifecycle of the activity, establish and cancel the connection to the map service for mapview.

2. mapview-controls the view component in mapview, manages overlay, and provides basic view functions.
Use multiple map modes (MAP mode (some cities can update traffic conditions in real time), satellite mode, street view mode) to view Google Map

3. mapcontrol maps are moved, scaled, and centered on a GPS coordinate.

4. Overlay-overwrite the top layer of mapview. You can extend its ondraw interface to display some of your own items in mapview. Mapview manages overlay through mapview. getoverlays.
In addition to the basic overlay class, Google also extends two more useful overlay classes.
1) mylocationoverlay-integrates the interface for receiving current coordinates in Android. Location, and integrates the compasssensor interface in sersormanager
We only need enablemylocation () and enablecompass to provide real-time mylocation and compass functions for our programs.

2) itemlizedoverlay-manages an overlayitem linked list and marks images and other resources with the same style on the map.

5. Conversion of GPS coordinates and device coordinates in projection-mapview

3.2 implement
The first steps with Android and Google Maps:
Http://blogs.itemis.de/frey/2009/04/04/location-based-services-on-android-part-1/
Http://blogs.itemis.de/frey/2009/04/07/location-based-services-on-android-part-2/
Http://blogs.itemis.de/frey/2009/04/15/location-based-services-on-android-part-33-customoverlays

4. Add-ons source code and related open-source projects
4.1add-ons source code of map. Jar (the version is earlier, but it is helpful to understand the entire framework and implementation of map)
Http://gitorious.org/android-maps-api/android-maps-api/trees/master/src/com/anconafamily/android/maps
If you want to go deeper, you can only decompile the class in the map. Jar under add-ons \ google_apis-3 \ libs.

4.2mapview-overlay-manager makes map applications more convenient to use.
Http://www.anddev.org/viewtopic.php? P = 25712

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/clybe/archive/2009/09/27/4602379.aspx

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.