Once the user gets into an activity, I need to send a value to the Web Service and, once s/he exits the activity, I need to send another value to the server. It needs to happen at that exactly moment. Android Developers guide says I should use Foreground Services for background tasks which need to be executed immediately, and WorkManager for deferable tasks. However, I do not need to update anything on the UI nor a notification (as they are mandatory in Foreground services) after the task is done...
What should I use?