Should I use WorkManager or is there any other better approach. Also, I want to use Retrofit to call the API every 15 minutes. WorkManager will execute the tasks even if we Kill the app but I only need to call API when the app is open. WorkManager is specifically for requests that need to persist and execute at some point.
When I cancel the work in onDestroy() it is not working as expected as onDestroy() will not be executed if we force close the app. How can I cancel the work in the work manager in order to meet my use-case of calling the API only when the app is open? Is the work manager intended for my use case?