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