Android Plugin-get the plugin installed in the apkplug framework-03

Source: Internet
Author: User

The previous article successfully embedded the apkplug framework into the application and started the link http://www.apkplug.com/blog? Post = 10 how to obtain all installed plug-ins

1. Obtain the context BundleContext of the SystemBundle of the framework.

Apkplug framework will automatically create a SystemBundle. It is the first plug-in of the framework and cannot be stopped or uninstalled. Through this plug-in, we can communicate with apkplug and Other plug-ins.

FrameworkInstance. getSystemBundle () can get SystemBundle, but it doesn't make much sense. We need to get its running context BundleContext

BundleContext context = frame. getSystemBundleContext ();

2. Obtain installed plug-ins through BundleContext

For (int I = 0; I {
// Obtain the installed plug-in

// Print the plug-in information

StringBuffer sb = new StringBuffer ();
Sb. append ("\ n plug-in name:" + B. getName ());
Sb. append ("\ n plug-in Application name:" + B. getSymbolicName ());
Sb. append ("\ n plug-in version:" + B. getVersion ());
Sb. append ("\ n plug-in ID:" + B. getBundleId ());
Sb. append ("\ n ins Current status:" + B. getState ());
Sb. append ("\ n ins start Activity:" + B. getBundleActivity ());
System. out. println (sb. toString ());

}

In this way, we can obtain all installed plug-ins, and we can use Bundle to obtain plug-ins or operate on these plug-ins (START, uninstall, and start plug-in Activity)

Www.apk plug.com

QQ chat group: 132433459

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.