I have created a RegistrationRepositoryWorker class
Copy code
@HiltWorker
class RegistrationRepositoryWorker @AssistedInject constructor(
@Assisted private val appContext: Context,
@Assisted private val workerParams: WorkerParameters,
private val mylApi: MyApi,
) :
CoroutineWorker(appContext, workerParams) {}
the code above fails with error Could not create Worker RegistrationRepositoryWorkerbut when I remove the MyApi from constructor it works well. How can I call the API correctly
Copy code
interface MyApi{
@POST("register") // Replace with the actual API endpoint
suspend fun registerUser(@Body request: User): Response<ApiResponse>
}
a
Ahsan Ullah Rasel
09/20/2023, 12:20 AM
Did you declared the instantiation of MyApi in module?