[Android] Android Application plug-in Development Solution

Source: Internet
Author: User

 

Android Application plug-in development solution I. Actual requirements

Generally, after an Android Application is developed to a certain stage, more and more functional modules will be available, and the APK installation package will become larger and larger, during use, you cannot selectively load the required functional modules. In this case, you may need to consider how to split the entire application.

Ii. solution proposal

Generally, there are two methods. One is to split an application into multiple applications based on its functions. Users can download either of them or both of them. Applications can be associated at the code level to share part of the information. Another method is similar to other Platform Plug-ins. You can choose to download the required plug-ins in the main application. If you do not need this function, you do not need to download the plug-ins.

The first method is to develop multiple applications. The second method is a little complicated and requires a lot of extra work. Here we will briefly discuss the general implementation method of the second method.

Iii. Implementation Method Overview

Someone may think, can someone download a DLL file or jar package like other platforms to automatically identify and load this function? Unfortunately, on the Android platform, the jar package cannot be directly loaded dynamically. The author did not think of a similar method. Therefore, to implement this function, you still need to load it in the form of an independent APK. Different from the first method, from the design perspective, a specific plug-in does not have an entry for independent operation, and desktop icons are not allowed to exist. It must be opened from the main application, go back to the main application. From the user's perspective, you can load and use the required functions in the application, which is similar to other Platform Plug-ins.

In order to implement this method, from the design point of view, we need to consider which functions are provided to users as independent plug-ins. We will not detail them here. The following describes what needs to be done from the development perspective.

Ø framework functions to be developed in the main application:

Identify whether a specific plug-in has been installed (based on the package name of the plug-in)

If the version has been installed, determine whether the upgrade is required (the server obtains the latest version and compares it with the local version)

Download and install (or upgrade) the plug-in

Uninstall this plug-in

Precautions for plug-in APK development:

Do not provide the Start entry in the manifest File

Notification on interaction between the main application and plug-in:

It is best to use the same Android: shareduserid. The plug-in can easily obtain the resources and databases of the primary application.

The main application can start a specific plug-in intent mode, and bring MAP type parameters or JSON string parameters to parse specific parameters in the plug-in APK to implement business logic.

Iii. Other Instructions

The content of this blog does not specifically describe how to implement it, and there is no code-level description. However, through the method described above, developers can basically understand how to implement plug-in Android applications. Specifically, developers may encounter many problems during the development process and need to explore and improve them themselves.

 

 

---------------------------------------------------------------------------

GL (arui319)

Http://blog.csdn.net/arui319

<This article can be reproduced, but please keep the above author information. Thank you.>

---------------------------------------------------------------------------

 

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.