Fixed
Status Update
Comments
su...@google.com <su...@google.com> #2
I forgot to mention that my Woker returns Result.SUCCESS always.
[Deleted User] <[Deleted User]> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 05f2d67cc04c5f76bee122b9e1e23ca1bf61a326
Author: Sumir Kataria <sumir@google.com>
Date: Tue Aug 21 16:36:05 2018
Fix periodic work so it executes repeatedly.
Processor.onExecuted is the wrong place for cancelling things in
other schedulers. It doesn't have the proper information about
what needs to be cancelled. For example, PeriodicWork should NOT
be cancelled. This should be done right before Schedulers.schedule
at the end of WorkerWrapper.
Bug: 112859683
Test: Added new tests for API 22-, manually tested using
integration app for 23+ since JobScheduler enforces a 15 minute
limit between executions
Change-Id: Ia0e6e17367fbc2493339b9b1275453267c571580
M work/workmanager/src/androidTest/java/androidx/work/impl/WorkManagerImplTest.java
M work/workmanager/src/main/java/androidx/work/impl/Processor.java
M work/workmanager/src/main/java/androidx/work/impl/WorkerWrapper.java
https://android-review.googlesource.com/735827
https://goto.google.com/android-sha1/05f2d67cc04c5f76bee122b9e1e23ca1bf61a326
Branch: androidx-master-dev
commit 05f2d67cc04c5f76bee122b9e1e23ca1bf61a326
Author: Sumir Kataria <sumir@google.com>
Date: Tue Aug 21 16:36:05 2018
Fix periodic work so it executes repeatedly.
Processor.onExecuted is the wrong place for cancelling things in
other schedulers. It doesn't have the proper information about
what needs to be cancelled. For example, PeriodicWork should NOT
be cancelled. This should be done right before Schedulers.schedule
at the end of WorkerWrapper.
Bug: 112859683
Test: Added new tests for API 22-, manually tested using
integration app for 23+ since JobScheduler enforces a 15 minute
limit between executions
Change-Id: Ia0e6e17367fbc2493339b9b1275453267c571580
M work/workmanager/src/androidTest/java/androidx/work/impl/WorkManagerImplTest.java
M work/workmanager/src/main/java/androidx/work/impl/Processor.java
M work/workmanager/src/main/java/androidx/work/impl/WorkerWrapper.java
su...@google.com <su...@google.com> #4
I am experiencing the same problem using the following code:
val myWorker = PeriodicWorkRequestBuilder<MyWorker>(15, TimeUnit.MINUTES)
myWorker.addTag(NEWSFEED_SYNC_WORKER_ID)
val constraints = Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)
.build()
myWorker.setConstraints(constraints)
WorkManager.getInstance().enqueue(myWorker.build())
val myWorker = PeriodicWorkRequestBuilder<MyWorker>(15, TimeUnit.MINUTES)
myWorker.addTag(NEWSFEED_SYNC_WORKER_ID)
val constraints = Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)
.build()
myWorker.setConstraints(constraints)
WorkManager.getInstance().enqueue(myWorker.build())
il...@google.com <il...@google.com> #5
The fix will be available in alpha08.
su...@google.com <su...@google.com>
ap...@google.com <ap...@google.com> #6
I'm facing this in alpha09 on Android Pie
su...@google.com <su...@google.com> #7
Update: alpha09 works fine in pre-Oreo with a minimum interval of 15 minutes. Post Oreo, never gets triggered. Haven't yet checked the interference of battery optimization. Will update on the same soon.
[Deleted User] <[Deleted User]> #8
Still facing this in alpha10 on Oreo and Pie
ra...@google.com <ra...@google.com> #9
solved in alpha 11 i have not this problem but some times WorkManger run 2 times instead one Worker class in Periodic work
ma...@gmail.com <ma...@gmail.com> #10
Is there any other way to use periodic job scheduler except WorkManager,Job Creator?
so...@gmail.com <so...@gmail.com> #11
is workmanager now available with boot aware changes.
Please let me know will library version it is.
Please let me know will library version it is.
so...@gmail.com <so...@gmail.com> #12
is workmanager now available with boot aware changes.
Please let me know will library version it is.
Please let me know will library version it is.
Description
My app starts by receiving "android.intent.action.LOCKED_BOOT_COMPLETED", WorkManager initial before user unlocked.
It cause crash:
java.lang.IllegalStateException: SharedPreferences in credential encrypted storage are not available until after user is unlocked
Because WorkManager use context.applicationContext accessing data/data/package/xxxx.
I tried to disable WorkManagerInitializer in AndroidManifest.xml and initial WorkManager on my first activity.But it cause another crash:
08-16 11:02:07.441 E/AndroidRuntime(19740): java.lang.RuntimeException: Unable to create service androidx.work.impl.background.systemjob.SystemJobService: java.lang.IllegalStateException: WorkManager needs to be initialized via a ContentProvider#onCreate() or an Application#onCreate().
08-16 11:02:07.441 E/AndroidRuntime(19740): at android.app.ActivityThread.handleCreateService(ActivityThread.java:3415)
08-16 11:02:07.441 E/AndroidRuntime(19740): at android.app.ActivityThread.-wrap4(Unknown Source:0)
08-16 11:02:07.441 E/AndroidRuntime(19740): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1738)
08-16 11:02:07.441 E/AndroidRuntime(19740): at android.os.Handler.dispatchMessage(Handler.java:106)
08-16 11:02:07.441 E/AndroidRuntime(19740): at android.os.Looper.loop(Looper.java:164)
08-16 11:02:07.441 E/AndroidRuntime(19740): at android.app.ActivityThread.main(ActivityThread.java:6618)
08-16 11:02:07.441 E/AndroidRuntime(19740): at java.lang.reflect.Method.invoke(Native Method)
08-16 11:02:07.441 E/AndroidRuntime(19740): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
08-16 11:02:07.441 E/AndroidRuntime(19740): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)
08-16 11:02:07.441 E/AndroidRuntime(19740): Caused by: java.lang.IllegalStateException: WorkManager needs to be initialized via a ContentProvider#onCreate() or an Application#onCreate().
08-16 11:02:07.441 E/AndroidRuntime(19740): at androidx.work.impl.background.systemjob.SystemJobService.onCreate(SystemJobService.java:67)
08-16 11:02:07.441 E/AndroidRuntime(19740): at android.app.ActivityThread.handleCreateService(ActivityThread.java:3405)
08-16 11:02:07.441 E/AndroidRuntime(19740): ... 8 more