JeremyLiao / LiveEventBus

:mailbox_with_mail:EventBus for Android,消息总线,基于LiveData,具有生命周期感知能力,支持Sticky,支持AndroidX,支持跨进程,支持跨APP
Apache License 2.0
3.89k stars 540 forks source link

关于跨进程通信 #82

Open cicada1993 opened 5 years ago

cicada1993 commented 5 years ago

版本: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)
JeremyLiao commented 5 years ago

目测配置没什么问题,对照demo再看下呢:https://github.com/JeremyLiao/LiveEventBus/tree/master/live-event-bus/app

xiaomage03 commented 4 years ago

@cicada1993 夸进程无法通信的问题解决了没 我也遇到同样的问题