Fixed
Status Update
Comments
ja...@gmail.com <ja...@gmail.com> #2
Seems like it happens on API 21-22 too.
vs...@google.com <vs...@google.com>
ja...@gmail.com <ja...@gmail.com> #3
This is expected. You are calling: enqueueUniquePeriodicWork() with an ExistingPeriodicWorkPolicy.REPLACE. This will cancel running work, and kick off new instances of all Workers.
https://github.com/rubensousa/WorkManagerKitkatBug/blob/master/app/src/main/java/com/github/rubensousa/workkitkatbug/MainActivity.kt#L24
so...@gmail.com <so...@gmail.com> #4
I just ran the sample again and now the behaviour is different for some weird reason. I forgot to mention that I only used REPLACE to test this properly. Because it also happens with KEEP.
ja...@gmail.com <ja...@gmail.com> #5
And shouldn't the behaviour be consistent across all Android versions?
tn...@google.com <tn...@google.com> #6
We don't see any issues with KEEP. If you have a way for us to reproduce any problems, please send us the appropriate instructions.
de...@google.com <de...@google.com> #7
Ok, I found something odd. Seems like setRequiredNetworkType(NetworkType.UNMETERED) causes this for some reason. I'm going to update the sample so you can review this again. Please, reopen this since it's not intended behavior.
Description
I propose adding a new annotation to support-annotations like @DeprecatedSdkVersion whose value property is an SDK_INT but also provides an optional details property for what method to use instead.
public @Interface DeprecatedSdkVersion {
int value();
String details = "";
}
Which can be used like this:
public final class ViewCompat {
@DeprecatedSdkVersion(Build.VERSION_CODES.LOLLIPOP)
public static int getElevation(View view) { ... }
@DeprecatedSdkVersion(
value = Build.VERSION_CODES.LOLLIPOP,
details = "Use view.getElevation() directly."
)
public static int getElevation(View view) { ... }
}
(Other potential names: @MaxSdkVersion, @UntilSdkVersion)
This would come with a corresponding lint check that would issue a warning if you were using one of these methods with a minSdkVersion higher than the annotation's value.