EventBus
EventBus copied to clipboard
Understanding About Sticky Events
@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
- Does the Android OS clear the memory of the whole app (Screen A & Screen B) or only my Screen B?
- 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.
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