问题描述
我需要使用(greenrobot)EventBus与远程服务进行通信.不幸的是,它似乎不适用于IPC. .查看代码,我也看不到任何解决方法.任何帮助将不胜感激!
I need to communicate with a remote service, using (greenrobot) EventBus. Unfortunately, it does not seem to work with IPC. Looking at the code, I don't see a workaround either. Any help would be appreciated !
奖金问题-是否还有其他支持IPC的EventBuse(适用于Android)?
Bonus question - are there any other EventBuses (for Android) which support IPC ?
推荐答案
greenrobot的EventBus(例如Square的Otto和LocalBroadcastManager
)的全部目的是不使用IPC.
The entire point of greenrobot's EventBus, like Square's Otto and LocalBroadcastManager
, is to not use IPC.
请勿将greenrobot的EventBus用于IPC.将Android的多种IPC机制之一用于IPC:
Don't use greenrobot's EventBus for IPC. Use one of Android's myriad IPC mechanisms for IPC:
-
startActivity()
-
startActivityForResult()
-
startService()
-
bindService()
-
sendBroadcast()
及其变体(例如,sendOrderedBroadcast()
) - 一个
ContentProvider
startActivity()
startActivityForResult()
startService()
bindService()
sendBroadcast()
and its variations (e.g.,sendOrderedBroadcast()
)- a
ContentProvider
这篇关于使用GreenRobot eventbus在Android中进行IPC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!