android 插件开发框架,GitHub - kymjs/CJFrameForAndroid: Android插件开发库,动态加载apk文件。...

#687474703a2f2f7777772e6b796d6a732e636f6d2f696d6167652f6c6f676f5f732e706e67

CJFrameForAndroid简介

CJFrame不再更新,推荐大家使用360的黑科技DroidPlugin 四大组件均可支持插件化。

CJFrameForAndroid 相关链接

原理描述

CJFrameForAndroid的实现原理是通过类加载器,动态加载存在于SD卡上的apk包中的Activity。通过使用一个托管所,插件Activity全部事务(包括声明周期与交互事件)将交由托管所来处理,间接实现插件的运行。更多介绍:CJFrameForAndroid原理介绍

一句话概括:CJFrameForAndroid中的托管所,复制了插件中的Activity,来替代插件中的Activity与用户交互。

框架使用

需要注意的是,插件中所涉及的权限,都需要在宿主中加以声明。宿主Manifest文件写法请参考:AndroidManifest.xml

你只需要在你项目想要启动插件的任意位置(UI线程中),例如Button的Onclick事件中加入如下代码即可。

/**

* @param context 上下文对象

* @param path 插件所在的绝对路径

*/

CJActivityUtils.startPlugin(context,path);

许可

Copyright (c) 2014, Zhang Tao.

Licensed under the Apache License, Version 2.0 (the "License");

you may not use this file except in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an "AS IS" BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值