Comments (2)
刚刚提交了一个例子
d25da55
后面再补充其他场景。
from shadow.
这个问题被问到的确实多诶😅 我应该补几个例子。
先在这文字说明一下。
宿主和插件的Service,都可以跨进程的相互使用。
插件的Service由于没有在系统中注册,所以不能直接用context使用。要通过PPS上的startPluginService或者bindPluginService方法使用。
但是在同一个插件内部,是可以正常用context使用的。因为context是被Shadow管理的。
同一个进程中只能有一个Loader,一个Loader可以同时启动多个插件,所以一个Loader的多个插件之间也是可以直接用context使用Service的。
除了Service这种最工程化的通信手段。也可以允许插件访问宿主中的一些类,通过在白名单注册一些类,允许插件直接访问宿主的类。可以利用这一点,将宿主的一些类做成单独的jar,宿主打包,插件编译。
from shadow.
Related Issues (20)
- PPS出现多实例错误,但是我只有一个PluginProcessPPS服务
- 从assets中复制apk出错 HOT 1
- 使用命令./gradlew packageDebugPlugin打包时出现错误
- 麻烦问一下我多个插件打包应该怎么写啊?有没有人指导一下
- PluginContainerActivity: DelegateProviderHolder没有初始化
- 发布宿主后如何实现插件更新新增,跪求指引
- 从宿主Activity打开插件Actvity后,当关闭插件Actvity后,无法正常返回上一个宿主Actvity,直接返回到了桌面 HOT 1
- 通过transform编译后的插件Activity代码在哪,我想学习一下 HOT 1
- 插件运行异常:ClassCastException com.tencent.shadow.sample.host.HostApplication to com.tencent.shadow.core.runtime.ShadowApplication
- com.tencent.shadow.core.runtime.ShadowActivity中缺少方法 HOT 1
- 请教下这里为什么要在主线程执行,线上项目这行创建webview实例时有ANR发生
- 找不到目录,有大佬遇到过这个问题吗? HOT 1
- 插件的服务需要无障碍权限的话,需要在哪边manifest注册?以及使用时判断权限的context该用哪个? HOT 1
- 优化建议:Shadow框架的数据库表shadowPluginManager中,数据太多时会导致插件启动慢 HOT 5
- 无法实例化壳子 HOT 1
- 插件启动服务失败,java.lang.ClassCastException: XXXAccessibilityService cannot be cast to com.tencent.shadow.core.runtime.ShadowService HOT 7
- About ZERO Reflection HOT 2
- decodePluginDebugBinaryManifest问题求教
- 集成uniapp原生基座提示错误 ShadowApplication中缺少方法:getProcessName HOT 4
- 为什么plugin-debug.zip中没有生成activity类啊 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shadow.