LiveEventBus
LiveEventBus copied to clipboard
关于跨进程通信
版本:com.jeremyliao:live-event-bus-x:1.5.5 跨进程收发消息似乎没生效 配置:
LiveEventBus.config()
.supportBroadcast(this)
.lifecycleObserverAlwaysActive(true)
.autoClear(true)
组件配置
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".lib.core.BookService"
android:process=":bookservice" />
代码
MainAtivity:
LiveEventBus.get(BookServiceDelegate.OPEN_BOOK_FAILED, String::class.java)
.observe(this, androidx.lifecycle.Observer<String?> {
})
BookService:
LogUtil.d("打开失败:" + System.currentTimeMillis().toString())
LiveEventBus.get(OPEN_BOOK_FAILED).broadcast(msg)
目测配置没什么问题,对照demo再看下呢:https://github.com/JeremyLiao/LiveEventBus/tree/master/live-event-bus/app
@cicada1993 夸进程无法通信的问题解决了没 我也遇到同样的问题