Android 上的插件框架,无需安装、修改或重新打包即可运行任何第三方 APK
DroidPlugin is a new Plugin Framework developed and maintained by Andy Zhang( Fllow me at github ). It enables the host app run any third-party apk without installation, modification and repackage, which benefit a lot for collaborative development on Android.
Unable to send Notification with custom Resources,eg:
a. Notification with custom RemoteLayout, which means Notification's contentView,tickerView,
bigContentView and headsUpContentView must be null.
b. Notification with icon customized by R.drawable.XXX. The framework will transform it to Bitmap instead.
Unable to define specified Intent Filter for the plugged app's Service、Activity、BroadcastReceiver
and ContentProvider. So the plugged app is invisible for the outside system and app.
Lack of Hook to the Native layer, thus apk (e.g. a majority of game apps) with native code cannot be loaded as plugin.
Service、Activity、BroadcastReceiver、ContentProvider in the host.It is very simple integrate Droid Plugin to your proejct:
Import Droid Plugin project to your project as a lib.
Include following attributes in host's AndroidManifest.xml:
<application android:name="com.morgoo.droidplugin.PluginApplication"
android:label="@string/app_name"
android:icon="@drawable/ic_launcher" >Or, if you use customized Application,add following code in the methods onCreate and attachBaseContext:
@Override
public void onCreate() {
super.onCreate();
PluginHelper.getInstance().applicationOnCreate(getBaseContext()); //must be after super.onCreate()
}
@Override
protected void attachBaseContext(Context base) {
PluginHelper.getInstance().applicationAttachBaseContext(base);
super.attachBaseContext(base);
}
Modify the authorityName value in Libraries\DroidPlugin\build.gradle (suggested use your package name)
Install/Upgrade, use this method:
int PluginManager.getInstance().installPackage(String filepath, int flags); For installation, filepath set to path of the .apk file, and flags set to 0.
For upgrade, filepath set to path of the .apk file, and flags set to PackageManagerCompat.INSTALL_REPLACE_EXISTING.
Uninstall, use this method:
int PluginManager.getInstance().deletePackage(String packageName,int flags); packageName is package name of the plugged app,flags = 0。
Activate
Just use android's API, same for communication between components.
Please feel free to report bugs or ask for help via email. QQ Group:318901026
##Who is using Droid Plugin?
Translated by Ming Song([email protected])jk
它是否支持 Android 13、14?请提供更新
安卓11开始就没有适配。安卓13的PackageParser变更、安卓14的PackageUserState变更等也没有适配。唉,还是自力更生,自己去适配吧。
输入框无法输入,点击5秒后崩溃。dispatching input event
Android 10 及以上是否有适配?
是 32 位而不是 64 位
找到一个不算是 bug 的 NPE--希望 DroidPluginTeam 接受
安装插件后,打开插件活动时会出现“class not found”错误。
JNI 层调用 IActivityManager.getLaunchedUid 发生崩溃
安装apk失败,提示 INSTALL_FAILED_CONFLICTING_PROVIDER