android-workmanager

Work Manager on chinese ROMs like Xiaomi and oppo, when under battery optimization, increase the scheduled delay of work by several hours

强颜欢笑 提交于 2020-08-15 05:46:10
问题 Work Manager on Chinese ROMs like Xiaomi and Oppo, when under battery optimization, increase the scheduled delay of work by several hours., however, I have noticed some apps like life360 are able to have scheduled jobs run quietly flawlessly even under battery optimization. There is one difference I noticed is that they show a notification every time the job runs, so would that be responsible for keeping the app alive by the battery optimizer? And I also noticed, that after I force stopped

WorkManager: ResolvableFuture can only be called from within the same library group prefix

拜拜、爱过 提交于 2020-07-22 16:57:30
问题 For some time in my ListenableWorker class I have used the following: public ListenableFuture<Result> startWork() { ResolvableFuture<Result> resolvableFuture = ResolvableFuture.create(); startSomeAsyncStuff(resolvableFuture); return resolvableFuture; } Basically, I start some asynchronous work, passing resolvableFuture into that function. When the async work is done, I call the following on that resolvableFuture object passed from my ListenableWorker : resolvableFuture.set(Result.success());

How to cancel Work from WorkManager in Android?

两盒软妹~` 提交于 2020-07-21 04:26:07
问题 I have saved the WorkManager UUID converted to String in Realm database. Here is the code - Constraints constraints = new Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build(); Data inputData = new Data.Builder().putString("downloadUrl", downloadUrl). putString("destinationFolder", destinationFolder). putInt("suraNumber", Integer.parseInt(suraNumber)). putString("fileName", fileName). putBoolean("downloadFileTypeBangla", downloadFileTypeBangla). putBoolean(

adb command to list all scheduled work using workmanager

老子叫甜甜 提交于 2020-07-19 06:00:47
问题 Is there a adb shell (dumpsys) command that will give a detailed info of all the tasks scheduled using workmanager - PeriodicWorkRequest Basically I have a scheduled task which should run daily. How do I get when Is the next task scheduled using adb. Will adb shell dumpsys alarm package.name list my scheduled work using workmanager 回答1: Given that WorkManager stores all the WorkRequest in a Room database, your bet bet is to retrieve that DB and look into it. For adb as far as I know, your

ListenableWorker does not remove notification icon

╄→гoц情女王★ 提交于 2020-07-18 22:35:32
问题 I am using ListenableWorker to perform background tasks. Also I want OS to be aware of my service importance, so I call setForegroundAsync(new ForegroundInfo(WorkerConstants.NOTIFICATION_FOREGROUND_ID, builder.build())); As suggested in the google documentation. But when my service stopped or cancelled, i can still see foreground service notification and i cannot remove it. Furthermore, I added cancel button to this notification, but it does nothing, I cannot close it: PendingIntent intent =

How to reduce time of PeriodicWorkManager in WorkManager

大兔子大兔子 提交于 2020-07-18 21:19:24
问题 In PeriodicTimeRequest minimum periodic time is 15 minute. I want to reduce it from 15 min to less than 15 minute.How can i do that? 回答1: You can not change the minimum time of 15 minutes. If it can be changed to less than that then it would not be called minimum. Depending on your need try using Alarm Manager or FCM. Refer to the following link for more details: https://developer.android.com/training/efficient-downloads/regular_updates 回答2: No, You cannot reduce the time to less than

WorkManager google api: wait 15 minutes for every periodic worker execution?

社会主义新天地 提交于 2020-07-06 11:37:17
问题 Is there a way to test a PERIODIC worker from WorkManager Google API without waiting at least 15 minutes for every execution? I mean, it is a DEBUG app and I'm running it through Android Studio and I don't want to wait such a long time to test my features. 回答1: You can't . Periodic work has a minimum interval of 15 minutes and it cannot have an initial delay. You can find the proof in the WorkSpec.java class. /** * Sets the periodic interval for this unit of work. * * @param intervalDuration

WorkManager google api: wait 15 minutes for every periodic worker execution?

不想你离开。 提交于 2020-07-06 11:37:12
问题 Is there a way to test a PERIODIC worker from WorkManager Google API without waiting at least 15 minutes for every execution? I mean, it is a DEBUG app and I'm running it through Android Studio and I don't want to wait such a long time to test my features. 回答1: You can't . Periodic work has a minimum interval of 15 minutes and it cannot have an initial delay. You can find the proof in the WorkSpec.java class. /** * Sets the periodic interval for this unit of work. * * @param intervalDuration

Android WorkManager: Cannot get output data from PeriodicWorkRequest

旧城冷巷雨未停 提交于 2020-06-15 07:35:29
问题 For some reasons I cannot get output data from PeriodicWorkRequest of Android WorkManager. The worker runs periodically as expected, it just doesn't return any data. My MainActivity: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); schedulePeriodicRequests(); } public void schedulePeriodicRequests() { PeriodicWorkRequest workRequest = new PeriodicWorkRequest.Builder(ServerRequestsWorker.class, 15,

Insert on Room DB does not trigger Observer on Activity

与世无争的帅哥 提交于 2020-04-17 22:14:54
问题 In my activity i have an Observer that observes this query @Query("""Select *, (Select account_id from accounts where account_id = from_account_id) as contact_account_id, (Select first_name from accounts where account_id = from_account_id) as contact_first_name, (Select last_name from accounts where account_id = from_account_id) as contact_last_name from messages inner join messageQueue on messages.client_message_id = messagequeue.client_message_id where ((msg_type = 1 and body <> "") or msg