# android

Mercy Jemosop

09/19/2023, 2:29 PM
I have created a RegistrationRepositoryWorker class
Copy code
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>

Ahsan Ullah Rasel

09/20/2023, 12:20 AM
Did you declared the instantiation of MyApi in module?

Mercy Jemosop

09/20/2023, 1:09 AM
I had missed some implementation in the module. after following this article
👍 1