Created
September 19, 2019 15:03
-
-
Save neonankiti/2d05ccc7b52d4ace66d397535a0c59cf to your computer and use it in GitHub Desktop.
Worker constructor injection for WorkManager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Repository @Inject constructor() | |
class BisonWorker @AssistedInject constructor( | |
@Assisted private val appContext: Context, | |
@Assisted private val params: WorkerParameters, | |
private val repository: Repository | |
) : Worker(appContext, params) { | |
override fun doWork(): Result { | |
Log.d(TAG, "$repository is injected") | |
return Result.success() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment