@Hiral For that, you will need to implement your own WorkerFactory class and set the worker configuration in your Application class. Something like below:
classDevWorker(appContext:Context,workerParameters:WorkerParameters,privatevaldevRepository:DevRepository):CoroutineWorker(appContext,workerParameters){overridesuspendfundoWork():Result{TODO("Do work with repository")}...}
This is one way of implementing this. If you are familiar with DI tools like dagger, there are other ways of implementing this.
I hope this helps.
How to create & pass someRepository instance to UpdateLocationWorker class?
@Hiral For that, you will need to implement your own
WorkerFactory
class and set the worker configuration in yourApplication
class. Something like below:This is one way of implementing this. If you are familiar with DI tools like dagger, there are other ways of implementing this.
I hope this helps.
thank u. This should work.