declex icon indicating copy to clipboard operation
declex copied to clipboard

Before fail an event, try to run it in the next round of the UI

Open smaugho opened this issue 6 years ago • 0 comments

It is a common situation to call some interface (ex, another activity), specially when integrating 3rd party services, and this activity will return running some Callback. Typically this callback is called before the onResume method, so EventBus hasn't been registered and the events sent from the Callback are not handled by the app.

To prevent this, typically something like this is done:

$UIThread();
$SomeEvent();

This solves the issue many times, but not always.

A general solution would be to check if the interface has been registered to listen the event, if not, then to post the event sticky, when the interface is registered with event bus, it can check the Sticky events, and dispatch the methods.

smaugho avatar Aug 22 '17 19:08 smaugho