Android app plug-in development solution

Source: Internet
Author: User

First, the real demand description

In general, an Android application in the development to a certain stage, the function module will be more and more, the APK installation package is also growing, users in the use of the process there is no way to selectively load their own required function modules. You might want to consider how to split the entire application at this point.

Second, the solution proposed

Generally there are two ways, one is to split the application into multiple applications according to function, which users need to download which, all need to download. Between applications, you can make certain connections at the code level to share part of the information. Another way, similar to other platform plug-in way, the user can be in the main application can selectively download the required plug-in, do not need this feature, you do not need to download.

In the first way, it's enough to develop multiple applications. The second approach is slightly more complex and requires a lot of extra work. Here we briefly discuss the approximate implementation of the second method.

Iii. Overview of the implementation methods

One might think that if you could download a DLL-like file or a jar package like any other platform, it would automatically recognize and load the feature? Unfortunately, the Android platform is not allowed to directly load the jar package, the author did not think of a similar approach. So, to do this, you still have to load it in a standalone apk. And the first way is different, from the design point of view, the specific plug-in is not independent operation of the portal, also does not allow the presence of desktop icons, must be opened from the main application, closed back to the main application (since the plugin is the APK, it installed after the installation of the entrance? How can there be no desktop icon? QQ Parkour and other games is not a plugin? No, there's an icon entry? )。 From a user's point of view, you can load the required functionality and use it in your app, which is similar to the way other platform plugins are.

In order to implement this approach, from a design perspective, it is necessary to consider which features are available to the user as standalone plugins, which are no longer detailed here. The following is an overview of the work that needs to be done from a development perspective.

Ø framework features that need to be developed in the main application:

Identify if the specific plugin is already installed (based on the plugin's package name)

If you have installed to determine if you need to upgrade (server-side to get the latest version and local comparison)

Download and install (or upgrade) the plugin

Uninstall the Plugin

Ø plug-in APK development needs to note:

Do not provide a boot entry in the manifest file

Ø tips for interacting between the main app and plug-ins:

The best use of the same android:shareduserid, plug-ins can easily get the main application of resources, databases and so on.

The main application can start the specific plug-in in intent mode, bring in the map type parameter or JSON string parameter, parse the specific parameters in the plugin apk, realize the business logic.

Iii. Other Notes

This blog content does not specify how to implement, there is no code-level instructions. But in the way described above, developers can basically understand how to implement plug-in Android applications. Specific, in the development process may also encounter a lot of problems, developers need to explore and improve their own.

Android app plug-in development solution

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.