8

I have a workmanager that every five hours picks up a word from the roomdb and Notification it

I do not know where is the righ place to put the work manager in the MVVM architecture. Should I use in ViewModel or Repository?

Mahdi Zareei
  • 134
  • 9

2 Answers2

2

For the workmanager you only have worker classes, so you need to create a new package named workers or workmanager and place your workers in that package.

Mohamed Rejeb
  • 2,281
  • 1
  • 7
  • 16
  • in Worker to get data and notification it , Do I have to request to the repository directly or use ViewModel ? – Mahdi Zareei Jun 28 '22 at 12:55
  • 1
    you can't use viewmodel in worker, you need to add your repository to the worker and use it. – Mohamed Rejeb Jun 28 '22 at 13:00
  • 2
    @MoCoding I think the question is where we should start worker class, directly inside of a viewmodel or inside of a repository – Tunahan Sep 09 '22 at 18:39
1

I think under datastore package or di package or make one work manager package and finally, work manager class can be used in ApplicationModule under di package,