EventBus icon indicating copy to clipboard operation
EventBus copied to clipboard

Understanding About Sticky Events

Open rk8339811 opened this issue 5 years ago • 1 comments

@greenrobot-team I have a doubt. Suppose I have multiple activities say Screen A(Main Screen) & Screen B.

Screen A opens Screen B and then Screen B registers for sticky events. And Screen B starts a service which sends sticky events. Now when the user minimizes the app and the service is running and since Android OS is short of memory then it clears the App.

Now I have two question

  1. Does the Android OS clear the memory of the whole app (Screen A & Screen B) or only my Screen B?
  2. Will my service also be cleared or will it continue to run? If it is cleared then can a foreground service with a notification help me to overcome this? And if yes will the sticky event be redelivered if the Screen B is recreated when the user opens the app from the recent list?

Any help would be grateful.

rk8339811 avatar May 28 '19 20:05 rk8339811

You should probably read https://developer.android.com/guide/components/activities/process-lifecycle

As for EventBus: if your app process gets killed, all sticky events are lost. They are not stored in e.g. the saved state of an activity. You need to take care of this yourself depending on your use case. https://developer.android.com/guide/components/activities/activity-lifecycle#saras

-Uwe

greenrobot-team avatar Jun 03 '19 09:06 greenrobot-team