I wish to start long-term operation, which as I think should be put into a service. Because I want to invoke it from a non-context class (Repository), I need to get somehow a context of an application. And as I also know passsing any context to the class may lead to memory leaks. So I found ContextWrapper class, which allows to use context, but I don't know is it safe to use or may be I shoud use other solution.
I am asking because I read a lot about this, but still not understand. I don`t know how to handle memory leaks, and I don't know how to determine is there a memory leak.
So my question is how to safely work with context from non-context classes, and for what reasons ContextWraper is used?
Thank you for answers.