realm-java icon indicating copy to clipboard operation
realm-java copied to clipboard

Avoid storing reference to ApplicationContext

Open cmelchior opened this issue 8 years ago • 1 comments

Right now we store a reference in the ApplicationContext which should be avoided due to InstantRun.

Instead we could:

  • Just get the reference to context.getFilesDir() and save that
  • get AssetManager and save that
  • Register the network receiver on init() without saving the context

I don't think we use it for anything else, but this approach would also work for any future additions.

Perhaps we could wrap it in a AndroidContext<Wrapper/Facade/Mediator> class ?

cmelchior avatar Sep 29 '16 05:09 cmelchior

Register the network receiver on init() without saving the context was done in https://github.com/realm/realm-java/pull/3529

zaki50 avatar Sep 29 '16 05:09 zaki50