Should I dispose disposables in a Singleton class ( Android RxJava 2 )
The (potentially) bigger concern here is that your singleton is doing work outside the lifecycle of an Android component. If your singleton is static or hosted by your Application
, then it may be terminated abruptly when your app is in the background. If that's not a problem, then the answer to your question is no, you do not need to dispose your subscription. However, you should still be wary of doing work while your app is running in the background, unless the user expects it. (And if they do, it should probably be in a Service
or run on a schedule.) The Application
and VM can persist long after the user perceives the app to be "closed", and excessive resource consumption may lead to bad ratings and uninstalls.