Skip to content
Advertisement

Resend Retrofit API call with a OneTimeWorkRequest

I am stuck and can’t get my OneTimeWorkRequest to work properly.

I have got this Retrofit API call I want to resend to the backend incase there’s no network connectivity or similar on the phone. What I can’t wrap my head around is how to pass the call to the worker.

I’ve got this following code:

Here’s the API Service:

JavaScript

The worker in the main class:

JavaScript

The worker class:

JavaScript

What am I missing, is it just the Worker class? And is it the application context I need in there? If so, how do I pass it?

Advertisement

Answer

I put all info in as putStrings, converted the date.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement