My app is targeting API 31/Android 12 and version 2.7.0 of WorkManager is required for that according to Google, so in order to do that, I have added setExpedited(OutOfQuotaPolicy.RUN_AS_NON_EXPEDITED_WORK_REQUEST) to my OneTimeWorkRequestBuilder and added the necessary changes in the AndroidManifest as well (see this link for details). However, when I ran my app I encountered this error:
java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Expedited WorkRequests require a ListenableWorker to provide an implementation for `getForegroundInfoAsync()`
There are no examples or documentation provided by Google on how to do this for RxWorker, but I found this answer here in Stackoverflow, but it is for Coroutines.
My question is how do you implement the said getForegroundInfoAsync for RxWorker when getForegroundInfoAsync has to return ListenableFuture<ForegroundInfo>--reading the docs it seems I have to add Guava to my app to do this? Since the docs for ListenableFuture says to Avoid implementing ListenableFuture from scratch. If you can't get by with the standard implementations, prefer to derive a new Future instance with the methods in Futures or, if necessary, to extend AbstractFuture.