I’m developing an android app, and I need to save some images from url to the smartphone internal memory. Now in the repository I’m using file output stream and retrieving the uri with the Android FileProvider, with the application context, and store the as string in the Room Database. But this approach breaks the MVVM pattern, because repository shouldn’t know anything about context. Should I call a service from the Activity/Fragment (maybe foreground so the download will finish even if app is killed)? There are other methods?
Source: Android Questions