diff --git a/CHINESE_README.md b/CHINESE_README.md index 6836e74..752588b 100644 --- a/CHINESE_README.md +++ b/CHINESE_README.md @@ -42,12 +42,23 @@ Andromeda和其他组件间通信方案的对比如下: ```groovy implementation 'org.qiyi.video.svg:core:1.0.0' ``` -在Application Module中使用gradle插件: +在application Module中使用gradle插件: ```groovy apply plugin: 'org.qiyi.svg.plugin' ``` # 使用方式 +## 为Dispatcher配置进程 +由于Dispatcher负责管理所有进程信息,所以它应该运行在存活时间最长的进程中。 +Dispatcher默认运行在主进程中。但是考虑到在有些App中,主进程不一定是存活时间最长的(比如音乐播放App中往往是播放进程的存活时间最长), +所以出现这种情况时开发者应该在application module的build.gradle中为Dispatcher配置进程名,如下: +```groovy + dispatcher{ + process ":downloader" + } +``` +在这里,":downloader"进程是存活时间最长的. + ## 初始化 最好是在自己进程的Application中进行初始化(每个进程都有自己的Andromeda对象),代码如下: ```java diff --git a/README.md b/README.md index 822438e..470d215 100644 --- a/README.md +++ b/README.md @@ -42,12 +42,24 @@ add core lib dependency in Application or library Module: ```groovy implementation 'org.qiyi.video.svg:core:0.9.3' ``` -apply gradle plugin in Application Module: +apply gradle plugin in application Module: ```groovy apply plugin: 'org.qiyi.svg.plugin' ``` # How to use +## Dispatcher config +**Dispatcher should always in the process that live longest cause it manager all process infos!.** +Default process of Dispatcher is main process. +Considering some process may live longer than main process in some apps(such as music app), developers should + config process name for Dispatcher in this case. Just as follows in build.gradle of application module: +```groovy + dispatcher{ + process ":downloader" + } +``` +In this case, ":downloader" process is the one that live longest. + ## init add init code in Application.onCreate(): ```java @@ -56,7 +68,7 @@ add init code in Application.onCreate(): Please make sure Andromeda inited before use if you don't init it in Application.onCreate(). ## Register and use local service -### definition and implementation of local service +### Definition and implementation of local service There are only two differences between local service and normal interfaces: + interfaces should be put in a common module to make it accessible to all modules + Andromeda will only hold one implementation at a time @@ -138,7 +150,7 @@ public class BuyAppleImpl extends IBuyApple.Stub { } ``` -### Registration +### Registration of remote service Differen from registration of local service, IBinder of remote service is need for registration : ```java Andromeda.registerRemoteService(IBuyApple.class, BuyAppleImpl.getInstance().asBinder());