Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

引入的org.simple.eventbus中stick无法使用 #369

Open
AlexFugui opened this issue Jun 4, 2020 · 4 comments
Open

引入的org.simple.eventbus中stick无法使用 #369

AlexFugui opened this issue Jun 4, 2020 · 4 comments

Comments

@AlexFugui
Copy link

相同的问题链接:hehonghui/AndroidEventBus#38
我想项目中需要发送粘性广播.
使用EventBus.getDefault().postSticky("string", EventBusTags.TARGET_ID);方法后在第二个跳转的未注册eventBus的activity或fragment中.无法收到粘性广播.
查看eventBus源码后发现postSticky(Object event, String tag)方法中将处理注释掉了/不知道是什么原因

目前只支持已经注册的页面接收消息.粘性消息相当于无效化.是否考虑修改代码或使用其他依赖

@BatriderD
Copy link

可以试一下
@OverRide
public boolean useEventBus() {
EventBus.getDefault().registerSticky(this);
return true;
}
手动加一下粘性注册

@AlexFugui
Copy link
Author

可以试一下
@OverRide
public boolean useEventBus() {
EventBus.getDefault().registerSticky(this);
return true;
}
手动加一下粘性注册

额老铁不是注册问题,源码里面,postSticky(Object event, String tag)方法是被注释的,也就是说发出去也没有代码执行

@BatriderD
Copy link

大兄弟 试一下,我也看到哪个注释了。虽然我是没太看懂源码,不过测试了一下是A页面post post 过段时间B页面注册这个粘性事件可以收到的。
感觉粘性事件 可以在注册时候取接收的再去取事件的。

@AlexFugui
Copy link
Author

大兄弟 试一下,我也看到哪个注释了。虽然我是没太看懂源码,不过测试了一下是A页面post post 过段时间B页面注册这个粘性事件可以收到的。
感觉粘性事件 可以在注册时候取接收的再去取事件的。

好嘞,谢谢老铁了,应该是我这边注册的问题.默认是只进行了普通注册
感激不尽

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants