Giter Club home page Giter Club logo

Comments (11)

hehonghui avatar hehonghui commented on July 25, 2024

你的意思是在Activity注册成功之前Application实际上已经发布了一个消息,此时Actiivty就接不到这个消息。你需要的就是Sticky模式,按照这个模式发布的消息可以在任意时刻获取到,跟时序无关。对吗?

from androideventbus.

forrestpan05 avatar forrestpan05 commented on July 25, 2024

是的,我现在 网络状态改变 只在一个地方进行post,
当activity创建后, 网络状态改变可以接收到,比如此时接收到网络连接上 相应地调用 onNetworkConnect(), 进行联网获取数据
但是当网络本身就是连接上, 此时进入 activity 就不会接收到 网络状态改变的消息,
因此我需要主动调用 onNetworkConnect(), 进行联网获取数据

from androideventbus.

hehonghui avatar hehonghui commented on July 25, 2024

sorry,目前还没有增加这个功能的打算,你可以自己实现一下类似的功能。

from androideventbus.

forrestpan05 avatar forrestpan05 commented on July 25, 2024

可以看看android 网络状态改变的广播,activity 在注册此广播,即使在网络状态没有改变的情况下,也会收到的

from androideventbus.

551780457 avatar 551780457 commented on July 25, 2024

看eventbus源码分析时,竟然没看懂Sticky是什么意思,现在明白了,感觉这真是一个很妙的功能

from androideventbus.

hehonghui avatar hehonghui commented on July 25, 2024

@forrest-pan @551780457 已简单支持Sticky事件

from androideventbus.

551780457 avatar 551780457 commented on July 25, 2024

如果sticky事件可以加强一下就好了,eventbus的sticky事件只能保存一个事件,嗯,有时候不一定能满足需求
我简单改过,不过感觉太粗糙了 :(

from androideventbus.

hehonghui avatar hehonghui commented on July 25, 2024

@551780457 目前是很简单的支持,那天有人说了他要用,我就临时给他加的。没空弄了,有需求的可以自行处理一下源码

from androideventbus.

wurensen avatar wurensen commented on July 25, 2024

看源码的时候,思考了很久不知道具体有什么应用场景需要有sticky来支持,看到这里才知道1.0.4版本加入sticky的目的。

from androideventbus.

wurensen avatar wurensen commented on July 25, 2024

看了源码发现用sticky发布的事件不支持多态了(没有加入匹配策略的支持)。

from androideventbus.

hehonghui avatar hehonghui commented on July 25, 2024

@wurensen 恩,已发现这个问题。明天处理一下

from androideventbus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.