مدیر کار
| آخرین بهروزرسانی | انتشار پایدار | کاندیدای انتشار | انتشار بتا | انتشار آلفا |
|---|---|---|---|---|
| ۲۲ اکتبر ۲۰۲۵ | ۲.۱۱.۰ | - | - | - |
اعلام وابستگیها
برای افزودن وابستگی به WorkManager، باید مخزن Google Maven را به پروژه خود اضافه کنید:
وابستگیهای مربوط به مصنوعات مورد نیاز خود را در فایل build.gradle برای برنامه یا ماژول خود اضافه کنید:
شیار
dependencies { def work_version = "2.11.0" // (Java only) implementation "androidx.work:work-runtime:$work_version" // Kotlin + coroutines implementation "androidx.work:work-runtime-ktx:$work_version" // optional - RxJava2 support implementation "androidx.work:work-rxjava2:$work_version" // optional - GCMNetworkManager support implementation "androidx.work:work-gcm:$work_version" // optional - Test helpers androidTestImplementation "androidx.work:work-testing:$work_version" // optional - Multiprocess support implementation "androidx.work:work-multiprocess:$work_version" }
کاتلین
dependencies { val work_version = "2.11.0" // (Java only) implementation("androidx.work:work-runtime:$work_version") // Kotlin + coroutines implementation("androidx.work:work-runtime-ktx:$work_version") // optional - RxJava2 support implementation("androidx.work:work-rxjava2:$work_version") // optional - GCMNetworkManager support implementation("androidx.work:work-gcm:$work_version") // optional - Test helpers androidTestImplementation("androidx.work:work-testing:$work_version") // optional - Multiprocess support implementation("androidx.work:work-multiprocess:$work_version") }
برای اطلاعات بیشتر در مورد استفاده از افزونههای کاتلین، به مستندات ktx مراجعه کنید.
برای اطلاعات بیشتر در مورد وابستگیها، به بخش «افزودن وابستگیهای ساخت» مراجعه کنید.
بازخورد
بازخورد شما به بهبود Jetpack کمک میکند. اگر مشکلات جدیدی کشف کردید یا ایدههایی برای بهبود این کتابخانه دارید، به ما اطلاع دهید. لطفاً قبل از ایجاد یک کتابخانه جدید، نگاهی به مشکلات موجود در این کتابخانه بیندازید. میتوانید با کلیک بر روی دکمه ستاره، رأی خود را به یک مشکل موجود اضافه کنید.
برای اطلاعات بیشتر به مستندات ردیاب مشکل مراجعه کنید.
نسخه ۲.۱۱
نسخه ۲.۱۱.۰
۲۲ اکتبر ۲۰۲۵
androidx.work:work-*:2.11.0 منتشر شد. نسخه 2.11.0 شامل این کامیتها است.
تغییرات مهم از زمان انتشار ۲.۱۰.۰:
-
minSdkاز API 21 به API 23 بهروزرسانی شده است. - API
setRemoteSessionTimeoutMillisدر سازنده پیکربندیWorkManagerاضافه شده است تا امکان پیکربندی مدت زمان فعال بودن یک جلسهRemoteWorkManagerاز آخرین استفاده آن را فراهم کند.
نسخه ۲.۱۱.۰-rc01
۸ اکتبر ۲۰۲۵
androidx.work:work-*:2.11.0-rc01 منتشر شد. نسخه 2.11.0-rc01 شامل این کامیتها است.
نسخه ۲.۱۱.۰-بتا۰۱
۲۴ سپتامبر ۲۰۲۵
androidx.work:work-*:2.11.0-beta01 منتشر شد. نسخه 2.11.0-beta01 شامل این کامیتها است.
تغییرات API
رفع اشکالات
- رفع مشکل توقف سرویس پیشزمینه هنگام وجود دستورات در حال انتظار ( Iae822 ، b/432069314 )
- رفع مشکل عدم اتصال سرویس ریموت توسط Coroutine Worker ( I842f2 ، b/247113322 )
نسخه ۲.۱۱.۰-آلفا۰۱
۲۷ آگوست ۲۰۲۵
androidx.work:work-*:2.11.0-alpha01 منتشر شد. نسخه 2.11.0-alpha01 شامل این کامیتها است.
تغییرات API
- minSdk از API 21 به API 23 بهروزرسانی شده است ( Ibdfca ، b/380448311 ، b/435705964 ، b/435705223 )
- API
setRemoteSessionTimeoutMillisدر سازنده پیکربندی WorkManager اضافه شده است تا امکان پیکربندی مدت زمان فعال بودن یک جلسه RemoteWorkManager از آخرین استفاده آن را فراهم کند. ( Ib23c8 ) - یک API آزمایشی در
WorkRequest.Builderاضافه کنید تا وقتی سیستم کار را متوقف میکند، backoff اعمال شود. ( Ie2dc7 , b/335513480 ) - API تست را برای ارسال یک کلاس worker متفاوت از کلاسی که برای پشتیبانی از پیادهسازیهای سفارشی
WorkerFactoryساخته شده است، بهTestListenableWorkerBuilderاضافه کنید ( If6bff ، b/389154854 ).
رفع اشکالات
- قابلیتهای شبکه را در
SharedNetworkCallbackذخیره کنید تا از IPCهای غیرضروری جلوگیری شود ( Ie4027 ، b/427115602 ) - مشکلی را در ارزیابی محدودیتهای شبکه برطرف کنید که در آن آیتمهای کاری بعد از اولین مورد، قابلیتهای شبکه فعلی را دریافت نمیکردند و در عوض پس از یک مهلت زمانی به
ConstraintsNotMetمیرسیدند ( Ib6a66 ، b/427115602 )
نسخه ۲.۱۰
نسخه ۲.۱۰.۵
۲۴ سپتامبر ۲۰۲۵
androidx.work:work-*:2.10.5 منتشر شد. نسخه 2.10.5 شامل این کامیتها است.
رفع اشکالات
- رفع مشکل توقف سرویس پیشزمینه هنگام وجود دستورات در حال انتظار ( Iae822 ، b/432069314 )
نسخه ۲.۱۰.۴
۱۰ سپتامبر ۲۰۲۵
androidx.work:work-*:2.10.4 منتشر شد. نسخه 2.10.4 شامل این کامیتها است.
رفع اشکالات
- رفع مشکل عدم توانایی
RemoteCoroutineWorkerدر جدا کردن سرویس از راه دور ( I842f2 ، b/247113322 )
نسخه ۲.۱۰.۳
۳۰ ژوئیه ۲۰۲۵
androidx.work:work-*:2.10.3 منتشر شد. نسخه 2.10.3 شامل این کامیتها است.
رفع اشکالات
- مشکلی را برطرف کنید که در آن کارگرانی با محدودیتهای شبکه یکسان با کارگر قبلی، گزارش میدادند که محدودیتهای آنها برآورده نشده است. ( b/427115602 )
نسخه ۲.۱۰.۲
۱۸ ژوئن ۲۰۲۵
androidx.work:work-*:2.10.2 منتشر شد. نسخه 2.10.2 شامل این کامیتها است.
رفع اشکالات
- مشکلی را برطرف کنید که هنگام اصرار بر کارگران با درخواستهای شبکه و قابلیتهای پیشفرض، منجر به اضافه شدن مجدد قابلیتهای حذف شده میشد و باعث میشد کارگران با محدودیتهای شبکه رفتار نادرستی داشته باشند. ( b/409716532 )
- رفع اشکالی که باعث میشد کارگرانی که محدودیتهای شبکه دارند، به دلیل عدم رعایت محدودیتها، حتی با وجود در دسترس بودن شبکه و قابلیتها، به سرعت اجرا نشوند. ( b/423403088 )
نسخه ۲.۱۰.۱
۲۳ آوریل ۲۰۲۵
androidx.work:work-*:2.10.1 منتشر شد. نسخه 2.10.1 شامل این کامیتها است.
رفع اشکالات
- احتمال بروز
TooManyRequestsExceptionاز ثبتNetworkCallbackتوسطWorkManagerکه برای ردیابی محدودیت استفاده میشود را کاهش دهید. ( b/231499040 , b309d5 )
نسخه ۲.۱۰.۰
۳۰ اکتبر ۲۰۲۴
androidx.work:work-*:2.10.0 منتشر شد. نسخه 2.10.0 شامل این کامیتها است.
تغییرات قابل توجه از نسخه ۲.۹.۱
- تگهای ردیابی به Jobs از
WorkManagerاضافه شد که فهم 'adb shell dumpsys jobscheduler' را بسیار سادهتر میکند، زیرا شامل نام Worker در حال اجرا خواهد بود. بخشهای ردیابی نیز در اطراف نواحی کلیدیWorkManagerاضافه شدهاند. -
Configuration.workerCoroutineContextبرای کنترل dispatcher کهCoroutineWorkerدر آن اجرا میشود، اضافه شده است. - توسعهدهندگان میتوانند
NetworkRequestبه عنوان یک محدودیت برای یک worker از طریق متدConstraints.setRequiredNetworkRequestمشخص کنند. این امر امکان کنترل دقیقتر بر روی شبکهای که این worker باید اجرا کند را فراهم میکند. -
WorkManager2.10.0 اکنون با SDK 35 کامپایل شده است و شامل تغییرات مختلفی برای سازگاری با SDK 35 است.
نسخه ۲.۱۰.۰-rc01
۲۴ اکتبر ۲۰۲۴
androidx.work:work-*:2.10.0-rc01 منتشر شد. نسخه 2.10.0-rc01 شامل این کامیتها است.
نسخه ۲.۱۰.۰-بتا۰۱
۲ اکتبر ۲۰۲۴
androidx.work:work-*:2.10.0-beta01 منتشر شد. نسخه 2.10.0-beta01 شامل این کامیتها است.
نسخه ۲.۱۰.۰-آلفا۰۴
۱۸ سپتامبر ۲۰۲۴
androidx.work:work-*:2.10.0-alpha04 منتشر شد. نسخه 2.10.0-alpha04 شامل این کامیتها است.
تغییرات API
- دلیل توقف
STOP_REASON_FOREGROUND_SERVICE_TIMEOUTبرای زمانی که یک کارگر پیشزمینه به دلیل اتمام زمان اجرا بر اساس نوع سرویس پیشزمینه متوقف میشود، اضافه کنید. ( Ibd0af )
نسخه ۲.۱۰.۰-alpha03
۴ سپتامبر ۲۰۲۴
androidx.work:work-*:2.10.0-alpha03 منتشر شد. نسخه 2.10.0-alpha03 شامل این کامیتها است.
ویژگیهای جدید
- تگهای ردیابی به Jobs از
WorkManagerاضافه شد که فهم 'adb shell dumpsys jobscheduler' را بسیار سادهتر میکند، زیرا شامل نام Worker در حال اجرا خواهد بود. بخشهای ردیابی نیز در اطراف نواحی کلیدیWorkManagerاضافه شدهاند.
تغییرات API
- WorkManager 2.10.0 اکنون با SDK 35 کامپایل شده است.
- رفع مشکل اتمام زمانبندی کارگران پیشزمینه از نوع 'short service' و 'data sync' و ایجاد خطای ANR در زمانی که
WorkManagerتابعstopSelf()فراخوانی نمیکرد. این رفع مشکل فقط در دستگاههایی با API 34 و 35 که انواع سرویسهای پیشزمینه در آنها معرفی شده بودند، اعمال میشود. ( ca06b2 ، b/364508145 ) - APIهای جدید
WorkerParametersکه امکان تغییر فرآیند از راه دور متصل بهWorkerرا هنگام استفاده ازWorkerFactoryفراهم میکنند. ( Ibdc8a ، Ie8a90 ، I7373f )
رفع اشکالات
- رفع مشکل کرش ناشی از تلاش
WorkManagerبرای راهاندازی مجدد یک worker طولانیمدت (یعنی یک worker پیشزمینه) در زمانی که نوع کار پیشزمینه مجوزهای پیشنیاز اندروید ۱۴ را داشت که لغو شده بودند. ( b/333957914 ) - حذف دستورالعمل دسترسی به APIهای پلتفرم جدید، زیرا این امر به طور خودکار از طریق مدلسازی API هنگام استفاده از R8 با AGP 7.3 یا بالاتر (مثلاً R8 نسخه 3.3) و برای همه نسخهها هنگام استفاده از AGP 8.1 یا بالاتر (مثلاً D8 نسخه 8.1) اتفاق میافتد. به مشتریانی که از AGP استفاده نمیکنند، توصیه میشود به D8 نسخه 8.1 یا بالاتر بهروزرسانی کنند. برای جزئیات بیشتر به این مقاله مراجعه کنید. ( Ia60e0 ، b/345472586 )
نسخه ۲.۱۰.۰-alpha02
۱۷ آوریل ۲۰۲۴
androidx.work:work-*:2.10.0-alpha02 منتشر شد. نسخه 2.10.0-alpha02 شامل این کامیتها است.
تغییرات API
- قابلیت انتشار محدودههای ردیابی از طریق یک
Tracerقابل تنظیم@RestrictToدرWorkManagerاضافه شد. ( I17d7f ، b/260214125 ) -
Configuration.workerCoroutineContextبرای کنترل dispatcher کهCoroutineWorkerدر آن اجرا میشود، اضافه شده است. این به جلوگیری کامل از استفاده ازDispatchers.DefaultدرWorkManagerکمک میکند. ( Icd1b7 ) - اضافه کردن کنترلکنندههای خطای سفارشی برای Workerها ( Ib1b74 ، b/261190695 )
-
OneTimeWorkRequest.BuilderوPeriodicWorkRequest.Builderاکنون میتوانند به جایClassباKClassساخته شوند:val request = OneTimeWorkRequest.Builder(Worker::class).setConstraints(...).build()( Ib55f6 ) - کلاس
WorkManagerبه کاتلین منتقل شد. اکنون متدهایی کهLiveData،ListenableFutureیاFlowرا برمیگردانند، اطلاعات صحیحی در مورد nullability ارائه میدهند. اگر فرضیات nullability در کد منبع کلاینتها نادرست باشد، ممکن است نیاز به تغییراتی در آن کد باشد. ( If6757 )
نسخه ۲.۱۰.۰-alpha01
۲۴ ژانویه ۲۰۲۴
androidx.work:work-*:2.10.0-alpha01 منتشر شد. نسخه 2.10.0-alpha01 شامل این کامیتها است.
ویژگیهای جدید
- توسعهدهندگان میتوانند
NetworkRequestبه عنوان یک محدودیت برای یک worker از طریق متدConstraints.setRequiredNetworkRequestمشخص کنند. این امر امکان کنترل دقیقتر بر روی شبکهای که این worker باید اجرا کند را فراهم میکند.
تغییرات API
- افزودن قابلیتی برای تعیین
NetworkRequestبه عنوان محدودیت. ( Id98a1 , b/280634452 )
نسخه ۲.۹
نسخه ۲.۹.۱
۷ آگوست ۲۰۲۴
androidx.work:work-*:2.9.1 منتشر شد. نسخه 2.9.1 شامل این کامیتها است.
رفع اشکالات
- رفع مشکل کرش ناشی از تلاش
WorkManagerبرای راهاندازی مجدد یک worker طولانیمدت (یعنی یک worker پیشزمینه) در زمانی که نوع کار پیشزمینه مجوزهای پیشنیاز اندروید ۱۴ را داشت که لغو شده بودند. ( b/333957914 )
نسخه ۲.۹.۰
۲۹ نوامبر ۲۰۲۳
androidx.work:work-*:2.9.0 منتشر شد. نسخه 2.9.0 شامل این کامیتها است.
تغییرات مهم از زمان ۲.۸.۰
- قابلیت مشاهده از طریق
Flow-s. به جایLiveData، اکنون میتوان پیشرفت Worker را از طریق Flowها و با استفاده ازWorkManager.getWorkInfosFlowو متدهای مشابه مشاهده کرد. - اکنون
WorkManagerسرنخی در مورد دلیل توقف قبلی یک worker ارائه میدهد. این سرنخ را میتوان از خود worker با استفاده از متدgetStopReason()یا ازWorkInfoبا استفاده ازgetStopReason()جستجو کرد. - زمانبندی دقیق workerهای دورهای از طریق
setNextScheduleTimeOverride. این امکان محاسبه پویای برنامه کاری Periodic بعدی را فراهم میکند که میتواند برای پیادهسازی ویژگیهای پیشرفتهای مانند زمانهای بهروزرسانی تطبیقی، رفتار تلاش مجدد سفارشی یا اجرای یک worker مربوط به newsfeed قبل از بیدار شدن کاربر هر روز صبح بدون هیچ گونه رانشی مورد استفاده قرار گیرد.ExistingPeriodicWorkPolicy.UPDATEباید با این تکنیکها استفاده شود تا از لغو worker در حال اجرا هنگام زمانبندی worker بعدی جلوگیری شود. - تست WorkManager با تطبیق نخبندی در تولید.
ExecutorsMode.PRESERVE_EXECUTORSمیتواند درinitializeTestWorkManagerبرای حفظ مجریان تنظیمشده درConfigurationو استفاده از نخ اصلی واقعی استفاده شود. - رابطهای برنامهنویسی کاربردی (API) کوروتینها مانند
CoroutineWorkerاز فایل work-runtime-ktx مربوط به مصنوع اضافی به فایل work-runtime مربوط به مصنوع اصلی منتقل شدهاند. فایل work-runtime-ktx اکنون خالی است.
تغییرات API
-
stopReasonبهWorkInfoاضافه شد. این قابلیت،stopReasonپس از اجرای worker در دسترس قرار میدهد. این قابلیت میتواند در گزارشstopReasonبه روشی قابل استفاده مفید باشد، زیرا به محض متوقف شدن یک worker، خود برنامه میتواند خیلی سریع از بین برود. ( I21386 ) - اجازه دهید
Clockاز طریق پیکربندی تنظیم شود و برای هدایت توالی اجرای تستهای Worker استفاده شود. ( Ic586e ) - متد
getStopReason()بهListenableWorkerاضافه شده است که دلیل توقف worker را نشان میدهد. ( I07060 ) - برای جلوگیری از هشدار Closeguard در مورد نشت منابع،
WorkManagerTestInitHelper#closeWorkDatabase()اضافه شد. ( Ia8d49 ) - سازندهی
WorkInfoاکنون عمومی است که میتواند در آزمایش مفید باشد. ( Ia00b6 , b/209145335 ) -
work-runtime-ktxاکنون خالی است،CoroutineWorkerو سایر ابزارهای خاص کاتلین اکنون در مصنوع اصلی work-runtime در دسترس هستند. ( I71a9a ) - متد
setNextScheduleTimeOverrideاضافه شد که امکان تنظیم دقیق برنامههای کاری دورهای را فراهم میکند ( I3b4da ) - تابع
getNextScheduleTimeMillisبرای دریافت اطلاعات زمان اجرای برنامهریزیشده بهWorkInfoاضافه شد. ( I797e4 ) - اطلاعات تأخیر اولیه و تناوب به
WorkInfoاضافه میشوند. ( I52f2f ) - متد اضافه شده برای مشاهدهی workerها از طریق Flowها از طریق متدهای
getWorkInfosByTagFlow،getWorkInfoByIdFlow،getWorkInfosForUniqueWorkFlow،getWorkInfosFlow( اگر122a ) - حاشیهنویسیهای
@RequiresApi(...)که وجود نداشتند به سازندهها و ویژگیهایConstraintsاضافه شدند. اکنون آنها با حاشیهنویسیهای مربوطه در setterها درConstraints.Builderکه از نسخههای اولیهWorkManagerوجود داشتند، همتراز شدهاند. ( I6d7d2 ) -
WorkManagerاکنون محدودیت جداگانهای برای کارگران uri محتوا دارد تا به آنها درJobSchedulerزمانهای تضمینشدهای بدهد تا از گم شدن بهروزرسانیهای محتوا تحت بار زیاد جلوگیری شود. این محدودیت را میتوان از طریقConfiguration.Builder.setContentUriTriggerWorkersLimit( Ic128f ) پیکربندی کرد. - محدودیتها به
WorkInfoاضافه میشوند. ( I162c0 )
نسخه ۲.۹.۰-rc01
۱۸ اکتبر ۲۰۲۳
androidx.work:work-*:2.9.0-rc01 منتشر شد. نسخه 2.9.0-rc01 شامل این کامیتها است.
- از آخرین نسخه بتا تغییری نکرده است
نسخه ۲.۹.۰-بتا۰۱
۶ سپتامبر ۲۰۲۳
androidx.work:work-*:2.9.0-beta01 منتشر شد. نسخه 2.9.0-beta01 شامل این کامیتها است.
تغییرات API
- ثابتهایی برای دلایل توقف که توسط
WorkInfo.stopReasonوListenableWorker.stopReasonبرگردانده میشوند، اضافه شدهاند ( I0cc00 )
نسخه ۲.۹.۰-آلفا۰۲
۲۶ ژوئیه ۲۰۲۳
androidx.work:work-*:2.9.0-alpha02 منتشر شد. نسخه 2.9.0-alpha02 شامل این کامیتها است.
ویژگیهای جدید
- اکنون
WorkManagerسرنخی در مورد دلیل توقف قبلی یک worker ارائه میدهد. این سرنخ را میتوان از خود worker با استفاده از متدgetStopReason()یا ازWorkInfoبا استفاده ازgetStopReason()جستجو کرد.
تغییرات API
-
stopReasonبهWorkInfoاضافه شد. این ویژگیstopReasonپس از اجرای worker در دسترس قرار میدهد. این ویژگی میتواند در گزارشstopReasonبه روشی قابل استفاده مفید باشد، زیرا به محض اینکه یک worker متوقف شود، خود برنامه میتواند خیلی سریع از بین برود. ( I21386 ) - اجازه دهید ساعت از طریق پیکربندی تنظیم شود و برای هدایت توالی اجرای تستهای Worker استفاده شود. ( Ic586e )
- متد
getStopReason()بهListenableWorkerاضافه شده است که دلیل توقف worker را نشان میدهد. ( I07060 ) - برای جلوگیری از هشدار Closeguard در مورد نشت منابع،
WorkManagerTestInitHelper#closeWorkDatabase()اضافه شد. ( Ia8d49 )
رفع اشکالات
- قابلیت دور زدن
overrideNextScheduleTimeبا استفاده ازTestDriverاضافه شد و مشکلات مربوط به تستپذیری برطرف شد. ( Ic2905 )
نسخه ۲.۹.۰-آلفا۰۱
۷ ژوئن ۲۰۲۳
androidx.work:work-*:2.9.0-alpha01 منتشر شد. نسخه 2.9.0-alpha01 شامل این کامیتها است.
ویژگیهای جدید
- قابلیت مشاهده از طریق
Flow-s. به جایLiveData، اکنون میتوان پیشرفت Worker را از طریق Flowها و با استفاده ازWorkManager.getWorkInfosFlowو متدهای مشابه مشاهده کرد. - زمانبندی دقیق workerهای دورهای از طریق
setNextScheduleTimeOverride. این امکان محاسبه پویای برنامه کاری Periodic بعدی را فراهم میکند که میتواند برای پیادهسازی ویژگیهای پیشرفتهای مانند زمانهای بهروزرسانی تطبیقی، رفتار تلاش مجدد سفارشی یا اجرای یک worker مربوط به newsfeed قبل از بیدار شدن کاربر هر روز صبح بدون هیچ گونه رانشی مورد استفاده قرار گیرد.ExistingPeriodicWorkPolicy.UPDATEباید با این تکنیکها استفاده شود تا از لغو worker در حال اجرا هنگام زمانبندی worker بعدی جلوگیری شود. - آزمایش
WorkManagerبا تطبیق نخبندی در تولید.ExecutorsMode.PRESERVE_EXECUTORSمیتواند برای حفظ مجریان تنظیمشده درConfigurationو استفاده از نخ اصلی واقعی استفاده شود. - رابطهای برنامهنویسی کاربردی (API) کوروتینها مانند
CoroutineWorkerازwork-runtime-ktxمربوط به مصنوع اضافی به فایلwork-runtimeمربوط به مصنوع اصلی منتقل شدهاند.work-runtime-ktxاکنون خالی است.
تغییرات API
- سازندهی
WorkInfoاکنون عمومی است که میتواند در آزمایش مفید باشد. ( Ia00b6 , b/209145335 ) -
work-runtime-ktxاکنون خالی است،CoroutineWorkerو سایر ابزارهای خاص کاتلین اکنون در مصنوع اصلیwork-runtimeدر دسترس هستند. ( I71a9a ) - متد
setNextScheduleTimeOverrideاضافه شد که امکان تنظیم دقیق برنامههای کاری دورهای را فراهم میکند ( I3b4da ) - نام
getEarliestRunTimeMillisبهgetNextScheduleTimeMillisتغییر یافت. ( I2bd7a ) - اطلاعات زمان اجرای بعدی برنامهریزیشده به
WorkInfoاضافه میشود. ( I797e4 ) - اطلاعات تأخیر اولیه و تناوب به
WorkInfoاضافه میشوند. ( I52f2f ) - متد اضافه شده برای مشاهدهی workerها از طریق Flowها از طریق متدهای
getWorkInfosByTagFlow،getWorkInfoByIdFlow،getWorkInfosForUniqueWorkFlow،getWorkInfosFlow( اگر122a ) - حاشیهنویسیهای
@RequiresApi(...)که وجود نداشتند به سازندهها و ویژگیهای Constraints اضافه شدند. اکنون آنها با حاشیهنویسیهای مربوطه در setterها درConstraints.Builderکه از نسخههای اولیهWorkManagerوجود داشتند، همتراز شدهاند. ( I6d7d2 ) -
WorkManagerاکنون محدودیت جداگانهای برای کارگران uri محتوا دارد تا به آنها درJobSchedulerزمانهای تضمینشدهای بدهد تا از گم شدن بهروزرسانیهای محتوا تحت بار زیاد جلوگیری شود. این محدودیت را میتوان از طریقConfiguration.Builder.setContentUriTriggerWorkersLimit( Ic128f ) پیکربندی کرد. - محدودیتها به
WorkInfoاضافه میشوند. ( I162c0 )
نسخه ۲.۸
نسخه ۲.۸.۱
۲۲ مارس ۲۰۲۳
androidx.work:work-*:2.8.1 منتشر شد. نسخه ۲.۸.۱ شامل این کامیتها است.
رفع اشکالات
- مشکل ANR در
RescheduleReceiverکه قبلاً به درستی دو پخش همزمان را مدیریت نمیکرد، برطرف شد. ( b/236906724 )
نسخه ۲.۸.۰
۸ فوریه ۲۰۲۳
androidx.work:work-*:2.8.0 منتشر شد. نسخه ۲.۸.۰ شامل این کامیتها است.
تغییرات مهم از زمان ۲.۷.۰
ویژگیهای جدید
- قابلیت بهروزرسانی
WorkRequestsبه روشی غیرمزاحم اضافه شده است که زمان اولیهی صفبندی را حفظ میکند، زنجیرهسازی میکند و غیره. برای جزئیات بیشتر به پست وبلاگ مفصل در مورد این ویژگی و همچنین javadocs برایWorkManager.updateWorkوExistingPeriodicWorkPolicy.UPDATEمراجعه کنید.
تغییرات API
-
WorkManager.updateWorkبرای بهروزرسانی کار با حفظ زمان اولیهی صفبندی و زنجیرهبندی آن اضافه شد. ( I9a248 ، b/219446409 ) -
ExistingPeriodicWorkPolicy.UPDATEاضافه شد. این خطمشی امکان بهروزرسانی یک کار دورهای را با نام آن فراهم میکند. این خطمشی مشابهREPLACEموجود است، اما مزاحمت کمتری دارد: اگر یک worker در حال اجرا باشد، آن را لغو نمیکند و زمان enqueue را حفظ میکند - تأخیر اولیه و دوره از زمان enqueue اصلی محاسبه میشوند، نه از زمان بهروزرسانی.REPLACEبرای کاهش سردرگمی بینREPLACEوUPDATEکه نامهای بسیار مشابهی دارند، منسوخ شده است. اگر هنوز میخواهید معنای قبلیREPLACEرا حفظ کنید، میتوانید ازCANCEL_AND_REENQUEUEکه به تازگی اضافه شده است و باREPLACEیکسان است، استفاده کنید. ( I985ed , b/219446409 ) - قابلیت رهگیری استثنائات زمانبندی با ارائه
Consumer<Throwable>از طریق setSchedulingExceptionHandler اضافه شد. - قابلیت ارائه
Consumer<Throwable>از طریق setInitializationExceptionHandler اضافه شد تا مشخص شود آیا هنگام تلاش برای مقداردهی اولیه WorkManager مشکلی وجود دارد یا خیر. - کمککنندههای درونخطی برای
OneTimeWorkRequestوPeriodicWorkRequestازandroidx.work:work-runtime-ktxبهandroidx.work:work-runtime( I0010f ، b/209145335 ) منتقل شدند. - متدهای کمکی
WorkQuery.fromIds،WorkQuery.fromStates،WorkQuery.fromUniqueWorkNames،WorkQuery.fromTagsبرای ایجاد مستقیمWorkQueryاضافه شدند. ( b/199919736 ) ( If48f2 ، b/199919736 ) -
getForegroundInfoبهWorkerاضافه شد. ( Ic1ead ) -
RxWorkerهم برای RxJava 2 و هم برای RxJava 3 اکنون دارایsetForegroundاست کهCompletableبرمیگرداند و میتوان از آن به جایsetForegroundInfoAsyncکهListenableFutureبرمیگرداند، استفاده کرد. -
RxWorkerهم برای RxJava 2 و هم برای RxJava 3 دارایgetForegroundInfoاست کهSingleبرمیگرداند و میتوان از آن به جایgetForegroundInfoAsyncکهListenableFutureبرمیگرداند، استفاده کرد ( b/203851459 ). - اکنون میتوان محدودیتها را مستقیماً ساخت، به جای استفاده از
Constraints.Builderکه برای کاربران کاتلین مناسبتر است. ( Idc390 ، b/137568653 ) - قابلیت بررسی مقداردهی اولیه
WorkManagerاضافه شد. همچنین، یک API جدیدgetConfiguration()برای توسعهدهندگان کتابخانه اضافه شد تا پیکربندیای را کهWorkManagerبا آن مقداردهی اولیه شده است، دریافت کنند. ( I6eff3 ، b/212300336 )
رفع اشکالات
- مشکلی در زمانبند حریصانه که مانع از اجرای فوری workerها هنگام بارگذاری میشد، برطرف شد. ( I9686b , b/248111307 )
-
@RequiresPermissionبه APIهایی که نیاز به اعطای مجوزPOST_NOTIFICATIONSدر SDK 33 و بالاتر دارند، اضافه شد. ( Ie542e ، b/238790278 ) - هنگام استفاده از
suspendCancellableCoroutineلغوها را درCoroutineScopeبهListenableFutureمنتشر کنید.
نسخه ۲.۸.۰-rc01
۷ دسامبر ۲۰۲۲
androidx.work:work-*:2.8.0-rc01 منتشر شد. نسخه 2.8.0-rc01 شامل این کامیتها است.
ویژگیهای جدید
- هیچ ویژگی جدیدی در این نسخه وجود ندارد. این عمدتاً یک تغییر نسخه است.
نسخه ۲.۸.۰-بتا۰۲
۹ نوامبر ۲۰۲۲
androidx.work:work-*:2.8.0-beta02 منتشر شد. نسخه 2.8.0-beta02 شامل این کامیتها است.
رفع اشکالات
- متد
equalsدرWorkInfoکه قبلاً اطلاعات نسل جدید را در نظر نمیگرفت، اصلاح شد. ( 4977cc )
نسخه ۲.۸.۰-بتا۰۱
۵ اکتبر ۲۰۲۲
androidx.work:work-*:2.8.0-beta01 منتشر شد. نسخه 2.8.0-beta01 شامل این کامیتها است.
رفع اشکالات
- مشکلی در زمانبند حریصانه که مانع از اجرای فوری workerها هنگام بارگذاری میشد، برطرف شد. ( I9686b , b/248111307 )
نسخه ۲.۸.۰-آلفا۰۴
۷ سپتامبر ۲۰۲۲
androidx.work:work-*:2.8.0-alpha04 منتشر شد. نسخه 2.8.0-alpha04 شامل این کامیتها است.
تغییرات API
-
WorkerInfo.getGeneration()وWorkerParameters.getGeneration()اضافه شدهاند که نسل یک worker را برمیگردانند. یک worker در صورتی که از طریقWorkManager.updateWorkیاWorkManager.enqueueUniquePeriodicWorkبا استفاده ازExistingPeriodicWorkPolicy.UPDATEبهروزرسانی شده باشد، چندین نسل دارد. توجه داشته باشید که اگر worker در حال اجرا باشد، این متد میتواند نسل جدیدتری را از worker در حال اجرا برگرداند، اگر بهروزرسانی در حین اجرای worker رخ داده باشد. ( I665c5 , b/219446409 ) ( I128a9 , b/219446409 ) -
InitializationExceptionHandlerاضافه شد، یک Exception Handler که میتواند برای تعیین وجود مشکل هنگام تلاش برای مقداردهی اولیهWorkManagerاستفاده شود. ( I061de )
نسخه ۲.۸.۰-alpha03
۱۰ آگوست ۲۰۲۲
androidx.work:work-*:2.8.0-alpha03 منتشر شد. نسخه 2.8.0-alpha03 شامل این کامیتها است.
ویژگیهای جدید
- قابلیتی برای بهروزرسانی
WorkRequestsبه روشی غیرمزاحم اضافه شده است که زمان اولیهی صفبندی را حفظ میکند، زنجیرهسازی میکند و غیره. برای جزئیات بیشتر بهWorkManager.updateWorkوExistingPeriodicWorkPolicy.UPDATEمراجعه کنید.
تغییرات API
-
WorkManager.updateWorkبرای بهروزرسانی کار با حفظ زمان اولیهی صفبندی و زنجیرهبندی آن اضافه شد. ( I9a248 ، b/219446409 ) -
ExistingPeriodicWorkPolicy.UPDATEاضافه شد. این خطمشی امکان بهروزرسانی یک کار دورهای را با نام آن فراهم میکند. این خطمشی مشابهREPLACEموجود است، اما مزاحمت کمتری دارد: اگر یک worker در حال اجرا باشد، آن را لغو نمیکند و زمان enqueue را حفظ میکند - تأخیر اولیه و دوره از زمان enqueue اصلی محاسبه میشوند، نه از زمان بهروزرسانی.REPLACEبرای کاهش سردرگمی بینREPLACEوUPDATEکه نامهای بسیار مشابهی دارند، منسوخ شده است. اگر هنوز میخواهید معنای قبلیREPLACEرا حفظ کنید، میتوانید ازCANCEL_AND_REENQUEUEکه به تازگی اضافه شده است و باREPLACEیکسان است، استفاده کنید. ( I985ed , b/219446409 ) - قابلیت رهگیری استثنائات زمانبندی با تعریف یک
SchedulingExceptionHandlerرا اضافه کنید. ( I033eb ) - کمککنندههای درونخطی برای
OneTimeWorkRequestوPeriodicWorkRequestازandroidx.work:work-runtime-ktxبهandroidx.work:work-runtime( I0010f ، b/209145335 ) منتقل شدند.
رفع اشکالات
-
@RequiresPermissionبه APIهایی که نیاز به اعطای مجوز POST_NOTIFICATIONS در SDK 33 و بالاتر دارند، اضافه شد. ( Ie542e ، b/238790278 )
نسخه ۲.۸.۰-آلفا۰۲
۶ آوریل ۲۰۲۲
androidx.work:work-*:2.8.0-alpha02 منتشر شد. نسخه 2.8.0-alpha02 شامل این کامیتها است.
تغییرات API
- اکنون میتوان محدودیتها را مستقیماً ساخت، نه با استفاده از Builder، که برای کاربران کاتلین مناسبتر است. ( Idc390 ، b/137568653 )
- قابلیت بررسی مقداردهی اولیه
WorkManagerاضافه شد. همچنین، یک API جدیدgetConfiguration()برای توسعهدهندگان کتابخانه اضافه شد تا پیکربندیای را کهWorkManagerبا آن مقداردهی اولیه شده است، دریافت کنند. ( I6eff3 ، b/212300336 )
نسخه ۲.۸.۰-آلفا۰۱
۱۲ ژانویه ۲۰۲۲
androidx.work:work-*:2.8.0-alpha01 منتشر شد. نسخه 2.8.0-alpha01 شامل این کامیتها است.
تغییرات API
- متدهای کمکی
WorkQuery.fromStates،WorkQuery.fromUniqueWorkNames،WorkQuery.fromTagsبرای ایجاد مستقیم WorkQuery اضافه شدند. ( If48f2 , b/199919736 ) - متدهای آزمایشی BuildCompat را برای SDK های آینده اضافه میکند ( Iafd82 ، b/207528937 )
-
getForegroundInfoبهWorkerاضافه کنید. ( Ic1ead ) - متدهای کمکی
WorkQuery.fromIdsبرای ایجاد WorkQuery مستقیماً از idها اضافه شدند. ( Ie5bdf , b/199919736 ) - RxWorker اکنون دارای
setForegroundاست کهCompletableبرمیگرداند و میتواند به جایsetForegroundInfoAsyncکهListenableFutureبرمیگرداند، استفاده شود ( I85156 ). - RxWorker برای RxJava 2 اکنون
getForegroundInfoدارد کهSingleبرمیگرداند و میتواند به جایgetForegroundInfoAsyncکهListenableFutureبرمیگرداند، استفاده شود. ( I21c91 ، b/203851459 ) - RxWorker برای RxJava 3 اکنون
getForegroundInfoرا دارد کهSingleبرمیگرداند و میتواند به جایgetForegroundInfoAsyncکهListenableFutureبرمیگرداند، استفاده شود ( I1ca8a ). - RxWorker اکنون
setForegroundCompletableبرمیگرداند که میتواند به جایsetForegroundInfoAsyncکهListenableFutureبرمیگرداند، استفاده شود. ( I992a3 , b/203851459 )
رفع اشکالات
- هنگام استفاده از
suspendCancellableCoroutineلغوها را درCoroutineScopeبهListenableFutureمنتشر کنید. ( I77e63 )
نسخه ۲.۷
نسخه ۲.۷.۱
۱۷ نوامبر ۲۰۲۱
androidx.work:work-*:2.7.1 منتشر شد. نسخه 2.7.1 شامل این کامیتها است.
رفع اشکالات
- لغوها در
CoroutineScopeهنگام استفادهsuspendCancellableCoroutineبهListenableFutureمنتشر میشوند. ( I77e63 ) - وقتی درخواستهای کاری با تأخیر به عنوان تسریعشده علامتگذاری شوند، بلافاصله یک استثنا ایجاد میشود. bef1762
نسخه ۲.۷.۰
۱۳ اکتبر ۲۰۲۱
androidx.work:work-*:2.7.0 منتشر شد. نسخه 2.7.0 شامل این کامیتها است.
تغییرات مهم از زمان ۲.۶.۰
WorkManager یک API جدید
WorkRequest.Builder.setExpedited(...)را معرفی میکند تا به محدودیتهای سرویسهای پیشزمینه در اندروید ۱۲ کمک کند.هنگام استفاده از
setExpedited(...)، WorkManager وظایف تسریعشده در JobScheduler را از اندروید ۱۲ به بعد واگذار میکند، در حالی که با واگذاری به یک سرویس پیشزمینه، سازگاری معکوس را در نسخههای قبلی اندروید فراهم میکند.
نسخه ۲.۷.۰-rc01
۲۹ سپتامبر ۲۰۲۱
androidx.work:work-*:2.7.0-rc01 منتشر شد. نسخه 2.7.0-rc01 شامل این کامیتها است.
این نسخه با androidx.work:work-*:2.7.0-beta01 یکسان است.
نسخه ۲.۷.۰-بتا۰۱
۱ سپتامبر ۲۰۲۱
androidx.work:work-*:2.7.0-beta01 منتشر شد. نسخه 2.7.0-beta01 شامل این کامیتها است.
ویژگیهای جدید
- کاهش تداخل چند فرآیندی SQLite هنگام مقداردهی اولیه WorkManager.
تغییرات API
- با توجه به اینکه APIهای پلتفرم اصلی برای اندروید ۱۲ (اس) پایدار هستند، APIهای
@ExperimentalExpeditedWorkحذف کنید. ( aosp/1792806 )
رفع اشکالات
- برای کارگران تسریعشدهای که
getForegroundInfoAsync()را پیادهسازی نمیکنند، پیام خطای بهتری ارائه دهید. ( aosp/1809376 )
نسخه ۲.۷.۰-آلفا۰۵
۲۱ ژوئیه ۲۰۲۱
androidx.work:work-*:2.7.0-alpha05 منتشر شد. نسخه 2.7.0-alpha05 شامل این کامیتها است.
این نسخه همچنین شامل رفع اشکالات نسخه WorkManager 2.6.0-beta02 است.
نسخه ۲.۷.۰-آلفا۰۴
۲ ژوئن ۲۰۲۱
androidx.work:work-*:2.7.0-alpha04 منتشر شد.
این نسخه همچنین شامل تغییرات نسخه ۲.۶.۰-بتا۰۱ است .
تغییرات API
-
ListenableWorker.setForegroundAsync()دیگر منسوخ شده است. - توصیه میکنیم در صورت امکان از API
WorkRequest.Builder.setExpedited(...)استفاده کنید. برای پشتیبانی بهتر از موقعیتهایی که برنامه مشمول محدودیتهای سرویس پیشزمینه نیست ، توسعهدهندگان میتوانند از APIListenableWorker.setForegroundAsync()استفاده کنند. - اگر
ListenableWorker.setForegroundAsync()فراخوانی شود، زمانی که برنامه مشمول محدودیتهای سرویس پیشزمینه باشد، خطای ForegroundServiceStartNotAllowedException رخ خواهد داد.
رفع اشکالات
- وقتی کارهای تسریعشده دوباره برنامهریزی میشوند، دیگر تسریعشده نیستند. آنها به کارهای عادی تبدیل میشوند.
نسخه ۲.۷.۰-آلفا۰۳
۲۱ آوریل ۲۰۲۱
androidx.work:work-*:2.7.0-alpha03 منتشر شد. نسخه 2.7.0-alpha03 شامل این کامیتها است.
ویژگیهای جدید
از WorkManager
2.6.0-alpha02: پشتیبانی از Workerهایی که میتوانند در هر فرآیندی اجرا شوند را اضافه میکند. ( Iaf200 )از WorkManager
2.6.0-alpha02: یکRemoteCoroutineWorkerاضافه شده است که پیادهسازیRemoteListenableWorkerاست و میتواند به یک فرآیند از راه دور متصل شود. ( I30578 )
تغییرات API
- از WorkManager
2.6.0-alpha02: پشتیبانی از محدودیت شبکهTEMPORARILY_UNMETEREDاضافه شد. ( I08d5e ) - از WorkManager
2.6.0-alpha02: پشتیبانی از کارگر چند فرآیندی برایsetProgressAsync(). ( Ib6d08 ) - از WorkManager
2.6.0-alpha02:WorkManagerInitializerعمومی کنید تا سایرandroidx.startup.Initializerها بتوانند از آنها به عنوان وابستگی استفاده کنند. ( I5ab11 )
نسخه ۲.۷.۰-آلفا۰۲
۱۰ مارس ۲۰۲۱
androidx.work:work-*:2.7.0-alpha02 منتشر شد. نسخه 2.7.0-alpha02 شامل این کامیتها است.
رفع اشکالات
- برای رفع مشکل کرش هنگام هدف قرار دادن اندروید ۱۲، قابلیت تغییرپذیری
PendingIntentبه صورت صریح تنظیم کنید. ( b/180884673 )
نسخه ۲.۷.۰-آلفا۰۱
۱۸ فوریه ۲۰۲۱
androidx.work:work-*:2.7.0-alpha01 منتشر شد. نسخه 2.7.0-alpha01 شامل این کامیتها است.
ویژگیهای جدید
WorkManager یک API جدید
WorkRequest.Builder.setExpedited(...)معرفی میکند تا محدودیتهای سرویسهای پیشزمینه در اندروید ۱۲ را در نظر بگیرد.برنامهها دیگر نمیتوانند وقتی در پسزمینه هستند، یک سرویس پیشزمینه را اجرا کنند. بنابراین، برای پشتیبانی بهتر از کارهای طولانیمدت که قبلاً به چرخه حیات یک سرویس پیشزمینه محدود بودند، برنامهها میتوانند
WorkRequestها را به عنوان تسریعشده علامتگذاری کنند.این API جایگزینی برای APIهای
setForegroundAsync(...)/setForeground(...)است که اکنون منسوخ شدهاند .هنگام استفاده از
setExpedited(...)، WorkManager وظایف تسریعشده درJobSchedulerرا از اندروید ۱۲ به بعد واگذار میکند، در حالی که با واگذاری به سرویسهای پیشزمینه، سازگاری معکوس را در نسخههای قبلی اندروید فراهم میکند.
تغییرات API
- پشتیبانی از
WorkRequestهای تسریعشده را اضافه کنید.
نسخه ۲.۶.۰
نسخه ۲.۶.۰
۱ سپتامبر ۲۰۲۱
androidx.work:work-*:2.6.0 منتشر شد. نسخه 2.6.0 شامل این کامیتها است.
تغییرات مهم از زمان ۲.۵.۰
WorkManager اکنون از
androidx.startupبرای مقداردهی اولیه WorkManager استفاده میکند. اگر در گذشتهtools:node="remove"ContentProviderکه برای مقداردهی اولیه WorkManager استفاده میشد، استفاده میکردید، باید به جای آن موارد زیر را انجام دهید.<provider android:name="androidx.startup.InitializationProvider" android:authorities=\"${applicationId}.androidx-startup" android:exported="false" tools:node=\"merge"> <!-- If you are using androidx.startup to initialize other components --> <meta-data android:name="androidx.work.WorkManagerInitializer" android:value="androidx.startup" tools:node="remove" /> </provider><!-- If you want to disable android.startup completely. --> <provider android:name="androidx.startup.InitializationProvider" android:authorities="${applicationId}.androidx-startup" tools:node="remove" />پشتیبانی از Workerهایی که میتوانند در هر فرآیندی اجرا شوند اضافه شد. ( Iaf200 )
یک
RemoteCoroutineWorkerاضافه شده است که پیادهسازی RemoteListenableWorker است و میتواند به یک فرآیند از راه دور متصل شود. ( I30578 )
نسخه ۲.۶.۰-rc01
۴ آگوست ۲۰۲۱
androidx.work:work-*:2.6.0-rc01 منتشر شد. نسخه 2.6.0-rc01 شامل این کامیتها است.
این نسخه با androidx.work:work-*:2.6.0-beta02 یکسان است.
نسخه ۲.۶.۰-بتا۰۲
۲۱ ژوئیه ۲۰۲۱
androidx.work:work-*:2.6.0-beta02 منتشر شد. نسخه 2.6.0-beta02 شامل این کامیتها است.
رفع اشکالات
-
RemoteWorkManagerاکنون به درستی ازRemoteWorkManagerServiceجدا میشود که بهRemoteWorkManagerServiceاجازه میدهد تا به درستی پاکسازی کند. aosp/1730694 -
RemoteListenableWorkerاکنون به درستی ازRemoteWorkerServiceجدا میشود که بهRemoteWorkerServiceاجازه میدهد تا به درستی پاکسازی کند. aosp/1743817 -
ForceStopRunnableاکنون فقط در فرآیند برنامه اصلی اجرا میشود. این یک بهینهسازی است و از رقابت منابع برای برنامههایی که از چندین فرآیند استفاده میکنند، جلوگیری میکند. aosp/1749180 ، aosp/1761729
نسخه ۲.۶.۰-بتا۰۱
۲ ژوئن ۲۰۲۱
androidx.work:work-*:2.6.0-beta01 منتشر شد. نسخه 2.6.0-beta01 شامل این کامیتها است.
این نسخه شامل برخی بهبودهای جزئی در مستندات است. این نسخه تا حد زیادی مشابه نسخه 2.6.0-alpha02 است.
نسخه ۲.۶.۰-آلفا۰۲
۲۱ آوریل ۲۰۲۱
androidx.work:work-*:2.6.0-alpha02 منتشر شد. نسخه 2.6.0-alpha02 شامل این کامیتها است.
ویژگیهای جدید
پشتیبانی از Workerهایی که میتوانند در هر فرآیندی اجرا شوند را اضافه میکند. ( Iaf200 )
یک
RemoteCoroutineWorkerاضافه شده است که پیادهسازیRemoteListenableWorkerاست و میتواند به یک فرآیند از راه دور متصل شود. ( I30578 )
تغییرات API
- پشتیبانی از محدودیت شبکه
TEMPORARILY_UNMETEREDاضافه شد. ( I08d5e ) - پشتیبانی از کارگر چند فرآیندی برای
setProgressAsync(). ( Ib6d08 ) -
WorkManagerInitializerعمومی کنید تا سایرandroidx.startup.Initializerها بتوانند از آنها به عنوان وابستگی استفاده کنند. ( I5ab11 )
نسخه ۲.۶.۰-آلفا۰۱
۲۴ مارس ۲۰۲۱
androidx.work:work-*:2.6.0-alpha01 منتشر شد. نسخه 2.6.0-alpha01 شامل این کامیتها است.
ویژگیهای جدید
WorkManagerاکنون ازandroidx.startupبرای مقداردهی اولیه WorkManager استفاده میکند. پیش از این، این کار توسطandroidx.work.impl.WorkManagerInitializerانجام میشد. ( aosp/1608813 )اگر در گذشته از
tools:node="remove"برای مقداردهی اولیه چرخه حیات فرآیندContentProviderاستفاده کردهاید، باید به جای آن موارد زیر را انجام دهید.<provider android:name="androidx.startup.InitializationProvider" android:authorities=\"${applicationId}.androidx-startup" android:exported="false" tools:node=\"merge"> <!-- If you are using androidx.startup to initialize other components --> <meta-data android:name="androidx.work.impl.WorkManagerInitializer" android:value="androidx.startup" tools:node="remove" /> </provider>(یا)
<!-- If you want to disable android.startup completely. --> <provider android:name="androidx.startup.InitializationProvider" android:authorities="${applicationId}.androidx-startup" tools:node="remove"> </provider>
تغییرات API
- یک API
Result.getOutputData()اضافه کنید کهoutputDataمربوط به ListenableWorker را برمیگرداند. ( Ie51e3 )
رفع اشکالات
- یک راه حل برای یک اشکال OEM اضافه کنید که باعث میشود هنگام استفاده از APIهای
AlarmManager، یکSecurityExceptionایجاد شود. ( aosp/1587518 )
نسخه ۲.۵.۰
نسخه ۲.۵.۰
۲۷ ژانویه ۲۰۲۱
androidx.work:work-*:2.5.0 منتشر شد. نسخه ۲.۵.۰ شامل این کامیتها است.
تغییرات عمده از زمان ۲.۴.۰
- A new
:work:work-multiprocessartifact for apps that use multiple processes. This introduces performance gains by unifying work request scheduling to a single process.- To use
work-multiprocess, define a dependency on:implementation "androidx.work:work-multiprocess:2.5.0" - Designate a primary process using Configuration.Builder.setDefaultProcessName(String) .
- When using
work-multiprocessyou also want to use RemoteWorkManager to manage yourWorkRequests. RemoteWorkManager always reaches out to the designated process. The in-process scheduler also runs in the designated process.
- To use
- Sometimes,
ActivityManagercannot instantiate theJobServiceinstance, to start a job. This causes the underlying job to get silently dropped because of a platform bug.WorkManagernow ensures that there are backing jobs for every singleWorkRequestwhen anApplicationis being initialized by reconciling jobs. This greatly improves job execution reliability. ( b/172475041 , aosp/1489577 ) -
WorkManagerlimits database growth by reducing the buffer duration thatWorkRequests are tracked after aWorkRequestis complete. The duration was7days previously. It has been reduced to1day + the keepResultsForAtLeast duration. ( aosp/1419708 ) - The
TestListenableWorkerBuildernow supports the reified class extendingListenableWorkerto make testing easier. ( aosp/1443299 , b/169787349 ) - WorkManager inspector is now available when using Android Studio Arctic Fox.
Version 2.5.0-rc01
۱۳ ژانویه ۲۰۲۱
androidx.work:work-*:2.5.0-rc01 is released. Version 2.5.0-rc01 contains these commits.
رفع اشکالات
- Fixed a bug where
getWorkInfosLiveDatawas not correctly getting invalidated after entities were updated when using theWorkQuerybased API. ( aosp/1540566 , b/173769028 ) - Fixed a bug where database transactions were not being marked as successful in some rare cases. This causes issues on some Motorola devices. ( aosp/1535368 , b/175944460 )
- Fixed a bug to ignore
NoSuchElementExceptions when trying to unbind from a dead process. ( aosp/1530589 ) - Improve
ConstraintTrackingWorkerto only stop aListenableWorkerif it's not already been stopped. ( aosp/1496844 , b/172946965 ) - Update androidx.work libraries to target Java 8 ( Ibd2f2 )
Version 2.5.0-beta02
۲ دسامبر ۲۰۲۰
androidx.work:work-*:2.5.0-beta02 is released. Version 2.5.0-beta02 contains these commits.
رفع اشکالات
- Fixed a bug in
androidx.work:work-multiprocesswhere WorkManager inadvertently blocked the calling thread when trying to bind to the designated process. ( aosp/1475538 ) - Fixed a bug where
PeriodicWorkRequests were not being reconciled correctly. ( b/172475041 , aosp/1489577 ) - Added a workaround for a platform bug when stopping the foreground service when using the
setForeground*APIs. ( b/170924044 , aosp/1489901 )
Version 2.5.0-beta01
۲۸ اکتبر ۲۰۲۰
androidx.work:work-*:2.5.0-beta01 is released. Version 2.5.0-beta01 contains these commits.
ویژگیهای جدید
-
WorkManagerautomatically throttles the number ofWorkRequests that can be picked up by the in-process scheduler. The requests are still executed in FIFO order. ( aosp/1455228 ) -
WorkManagerattempts to recover when the application's datastore is in a bad state. ( aosp/1463103 )
رفع اشکالات
- When
ListenableWorkers are interrupted, mark themENQUEUEDimmediately so they can be subsequently rescheduled. ( aosp/1455618 , b/170273988 )
Version 2.5.0-alpha03
۱۴ اکتبر ۲۰۲۰
androidx.work:work-*:2.5.0-alpha03 is released. Version 2.5.0-alpha03 contains these commits.
API Changes
-
TestListenableWorkerBuilderandTestWorkerBuilderdo not use raw types. ( I883ad , b/169787349 )
رفع اشکالات
- Use
ApplicationInfoto determine the name of the default app process. ( b/168716641 , aosp/1429950 ) - Fix the visibility rules for
RemoteWorkManagerandRemoteWorkContinuation. These APIs are no-longer marked as@Restricted. ( aosp/1432091 ) - Fix proguard rules for
:work:work-multiprocess. ( aosp/1432091 ) - Improve notification lifecycles for long running work bound to a foreground service. ( b/168502234 , aosp/1431331 )
Version 2.5.0-alpha02
۱۶ سپتامبر ۲۰۲۰
androidx.work:work-*:2.5.0-alpha02 is released. Version 2.5.0-alpha02 contains these commits.
ویژگیهای جدید
- Add an API to WorkQuery to be able to use
ids to queryWorkInfos. ( aosp/1412372 , b/157335295 ) - WorkManager better supports apps that use multiple processes with a new artifact (
androidx.work:work-multiprocess:*). This new artifact helps solve a few problems that large apps encounter including:- WorkManager typically needs to be initialized in every app process. This is not great because there is increased SQLite contention which in turn causes other problems. WorkManager now has new APIs which can be used to designate a primary app process using
Configuration#setDefaultProcessName(processName). TheprocessNameis a fully qualified process name which looks likepackageName:processName(egcom.example:remote). - A set of new APIs:
RemoteWorkManagerandRemoteWorkContinuationtoenqueue,cancelandquerywork requests. These APIs do not includeLiveDatavariants to avoid SQLite contention across multiple-processes. All calls toenqueue,cancelandqueryare forwarded to aprimaryapp process using AIDL and return a fluentListenableFuture. ( aosp/1392657 , aosp/1411210 , aosp/1412215 , aosp/1417713 )
- WorkManager typically needs to be initialized in every app process. This is not great because there is increased SQLite contention which in turn causes other problems. WorkManager now has new APIs which can be used to designate a primary app process using
API Changes
- WorkManager now prunes completed
WorkRequests that have no incomplete dependencies more aggressively. The buffer duration changed from7days to1day. ( aosp/1419708 )
رفع اشکالات
- WorkManager now reconciles jobs proactively so
WorkRequests andJobSchedulerjobs are in sync whenWorkManageris initialized. ( aosp/1412794 , b/166292069 )
Version 2.5.0-alpha01
۱۹ آگوست ۲۰۲۰
androidx.work:work-*:2.5.0-alpha01 is released. Version 2.5.0-alpha01 contains these commits.
ویژگیهای جدید
- Changes to internal APIs that allow us to provide better tooling with
WorkManagergoing forward. Stay tuned for additional updates.
رفع اشکالات
- Handle
SecurityExceptions when tracking network state on some devices. ( aosp/1396969 )
External Contribution
- Fix documentation for
ArrayCreatingInputMergerby Zac Sweers ( github/43 ).
Version 2.4.0
Version 2.4.0
۲۲ ژوئیه ۲۰۲۰
androidx.work:work-*:2.4.0 is released. Version 2.4.0 contains these commits.
Major changes since 2.3.0
-
WorkManagers in-process scheduler is now more capable. Previously, the in-processSchedulerwould only consider executing work that was not delayed and whose constraints were met. Now, the in-process scheduler tracksWorkRequests which might be executed in the future, including PeriodicWorkRequests. The in-processScheduleralso does not observe scheduling limits (but is still restricted to the size of theExecutorbeing used by WorkManager). This means that the application can now execute a lot more WorkRequests when the app is in the foreground. To manage execution of delayed work in the foreground,WorkManageralso introduces a new configurableRunnableScheduler. ( aosp/1185778 ) - WorkManager now supports RxJava 3. To use RxJava 3, you should include the following dependency:
implementation "androidx.work:work-rxjava3:2.4.0". ( aosp/1277904 ) - Added the ability to query for
WorkInfos by using aWorkQuery. This is useful when developers want to queryWorkInfos by a combination of multiple attributes. For more information look atWorkQuery.Builder.fromStates(...),WorkQuery.Builder. fromTags(...)orWorkQuery.Builder.fromUniqueWorkNames(...). ( aosp/1253230 , b/143847546 ) Add the ability to request diagnostic information from
WorkManagerusing:adb shell am broadcast -a "androidx.work.diagnostics.REQUEST_DIAGNOSTICS" -p "<your_app_package_name>"This provides a lot of useful information including:
- WorkRequests that were completed in the last 24 hours.
- WorkRequests that are currently RUNNING.
- Scheduled WorkRequests. ( aosp/1235501 )
Add
ExistingWorkPolicy.APPEND_OR_REPLACEwhich is similar toAPPEND, but replaces a chain that has cancelled or failed prerequisites. ( b/134613984 , aosp/1199640 )Provide the ability to add a custom
RunnableSchedulerto track WorkRequests that need to be executed in the future. This is used by the in-process Scheduler. ( aosp/1203944 )Add support for dynamically adding factories to delegate to, when using a
DelegatingWorkerFactory. ( b/156289105 , aosp/1309745 )Align tracking for
BATTERY_NOT_LOWconstraints more closely with the platform. ( aosp/1312583 )The in-process scheduler now uses better APIs to determine the name of the process. This is useful to better support apps that use multiple-processes. ( aosp/1324732 )
New Lint rules which enforce:
- Use of the right
foregroundServiceTypewhen usingsetForegroundAsync()APIs. ( b/147873061 , aosp/1215915 ) - Specifying JobScheduler ids that WorkManager should use when using JobService APIs directly. aosp/1223567
- Added a new lint rule that ensures that
ListenableWorkerimplementations are nowpublicwhen using the defaultWorkerFactory. ( aosp/1291262 )
- Use of the right
Calls to
setForegroundAsync()that do not complete before completion of aListenableWorkerwill now be signalled via anIllegalStateExceptionon the returnedListenableFuture. ( aosp/1262743 )Fix a bug where the
ForegroundServiceis not stopped after a foregroundWorkeris interrupted. ( b/155579898 , aosp/1302153 )Fix a bug where
WorkManagerattempts to execute multiple instances of aWorkerbound to a Foreground Service ( b/156310133 , aosp/1309853 )
Version 2.4.0-rc01
۲۴ ژوئن ۲۰۲۰
androidx.work:work-*:2.4.0-rc01 is released. Version 2.4.0-rc01 contains these commits.
رفع اشکالات
- The in-process scheduler now uses better APIs to determine the name of the process. This is useful to better support apps that use multiple-processes. ( aosp/1324732 )
Version 2.4.0-beta01
۲۰ مه ۲۰۲۰
androidx.work:work-gcm:2.4.0-beta01 , androidx.work:work-runtime:2.4.0-beta01 , androidx.work:work-runtime-ktx:2.4.0-beta01 , androidx.work:work-rxjava2:2.4.0-beta01 , and androidx.work:work-testing:2.4.0-beta01 are released. Version 2.4.0-beta01 contains these commits.
رفع اشکالات
- Fix a bug where the
ForegroundServiceis not stopped after a foregroundWorkeris interrupted. ( b/155579898 , aosp/1302153 ) - Fix a bug where
WorkManagerattempts to execute multiple instances of aWorkerbound to a Foreground Service ( b/156310133 , aosp/1309853 ) - Add support for dynamically adding factories to delegate to, when using a
DelegatingWorkerFactory. ( b/156289105 , aosp/1309745 ) - Align tracking for
BATTERY_NOT_LOWconstraints more closely with the platform. ( aosp/1312583 )
Version 2.4.0-alpha03
۲۹ آوریل ۲۰۲۰
androidx.work:work-*:2.4.0-alpha03 is released. Version 2.4.0-alpha03 contains these commits.
ویژگیهای جدید
- WorkManager now supports RxJava 3. To use RxJava 3, you should include the following dependency:
implementation "androidx.work:work-rxjava3:2.4.0-alpha03". ( aosp/1277904 ) - Added a new lint rule that ensures that
ListenableWorkerimplementations are nowpublicwhen using the defaultWorkerFactory. ( aosp/1291262 )
API Changes
- Calling
setProgressAsync()after aListenableWorkerhas finished execution will now signal anExceptionvia theListenableFuture. ( aosp/1285494 ) -
WorkQuery.Builderis now markedfinal. ( aosp/1275037 ) -
WorkQuery.Builderfactory methodswithStates,withTagsandwithUniqueWorkNameshave been renamed tofromStates,fromTagsandfromUniqueWorkNamesrespectively. ( aosp/1280287 )
رفع اشکالات
- Ignore
SecurityExceptions when tracking network state of a device. ( b/153246136 , aosp/1280813 )
Version 2.4.0-alpha02
۱ آوریل ۲۰۲۰
androidx.work:work-*:2.4.0-alpha02 is released. Version 2.4.0-alpha02 contains these commits.
ویژگیهای جدید
- Added a new Lint rule that warns when
WorkRequests requires bothConstraints.setRequiresCharging(...)andConstraints.setRequiresDeviceIdle(...). Some devices are never charging and idle at the same time. So such requests would run less frequently than expected. ( aosp/1253840 )
API Changes
Added the ability to query for
WorkInfos by using aWorkQuery. This is useful when developers want to queryWorkInfos by a combination of multiple attributes. For more information look atWorkQuery.Builder withStates(...),WorkQuery.Builder withTags(...)orWorkQuery.Builder withUniqueWorkNames(...). ( aosp/1253230 , b/143847546 )Calls to
setForegroundAsync()that do not complete before completion of aListenableWorkerwill now be signalled via anIllegalStateExceptionon the returnedListenableFuture. ( aosp/1262743 )
رفع اشکالات
- Fixed the lint rule that checks for invalid interval durations for
PeriodicWorkRequests. ( aosp/1254846 , b/152606442 )
Version 2.4.0-alpha01
۴ مارس ۲۰۲۰
androidx.work:work-*:2.4.0-alpha01 is released. Version 2.4.0-alpha01 contains these commits.
ویژگیهای جدید
WorkManagers in-process scheduler is now more capable. Previously, the in-process Scheduler would only consider executing work that was not delayed and whose constraints were met. Now, the in-process scheduler tracksWorkRequests which might be executed in the future, includingPeriodicWorkRequests. The in-process Scheduler also does not observe scheduling limits (but is still restricted to the size of theExecutorbeing used by WorkManager). This means that the application can now execute a lot moreWorkRequests when the app is in the foreground. ( aosp/1185778 )Added the ability to request diagnostic information from WorkManager using
adb shell am broadcast -a "androidx.work.diagnostics.REQUEST_DIAGNOSTICS" -p "<your_app_package_name>". This provides a lot of useful information including:- WorkRequests that were completed in the last 24 hours.
- WorkRequests that are currently RUNNING.
- Scheduled WorkRequests. ( aosp/1235501 )
New Lint rules which enforce:
- Use of the right
foregroundServiceTypewhen usingsetForegroundAsync()APIs. ( b/147873061 , aosp/1215915 ) - Specifying
JobSchedulerids thatWorkManagershould use when usingJobServiceAPIs directly. ( aosp/1223567 )
- Use of the right
API Changes
Add
ExistingWorkPolicy.APPEND_OR_REPLACEwhich is similar toAPPEND, but replaces a chain that has cancelled or failed prerequisites. ( b/134613984 , aosp/1199640 )Provide the ability to add a custom
RunnableSchedulerto trackWorkRequests that need to be executed in the future. This is used by the in-process Scheduler. ( aosp/1203944 )
رفع اشکالات
- Deprecated
setProgress()inRxWorkerbecause it previously returned aSingle<Void>which is an impossible type. Added a new APIsetCompletableProgress()which returns aCompletableinstead; and added new Lint rules which help migrate to the new APIs. ( b/150080946 , aosp/1242665 )
Version 2.3.4
Version 2.3.4
March 18, 2020
androidx.work:work-*:2.3.4 is released. Version 2.3.4 contains these commits.
رفع اشکالات
- Fixed a bug which would cause multiple instances of a long running
Workers to run, after exceeding the 10 minute execution window. ( aosp/1247484 , b/150553353 ) - Fix for WorkManager's lint
IssueRegistry. Thank you @ZacSweers from Slack, for the contribution. ( aosp/1217923 )
Version 2.3.3
Version 2.3.3
۴ مارس ۲۰۲۰
androidx.work:work-*:2.3.3 is released. Version 2.3.3 contains these commits.
رفع اشکالات
- Fixed a bug where if a
Workerwas interrupted, it would not get rescheduled correctly. ( b/150325687 , aosp/1246571 )
Version 2.3.2
Version 2.3.2
۱۹ فوریه ۲۰۲۰
androidx.work:work-*:2.3.2 are released. Version 2.3.2 contains these commits.
رفع اشکالات
- Fixes an issue where WorkManager exceeds the 100 job limit in JobScheduler in rare cases. ( aosp/1226859 , b/149092520 )
- Fix for a race condition in ConstraintControllers. ( aosp/1220100 )
- Improved the management foreground Service lifecycle for long running Workers. ( aosp/1226295 )
- Improved the management of cancellation of Notifications for long running Workers upon Worker cancellation. ( aosp/1228346 )
Version 2.3.1
Version 2.3.1
۵ فوریه ۲۰۲۰
androidx.work:work-*:2.3.1 is released. Version 2.3.1 contains these commits .
رفع اشکالات
- Better manage the lifecycle of
Notifications for long runningWorkers that run when a foregroundServiceis active. ( aosp/1218539 , b/147249312 ) -
WorkManagernow depends onandroidx.sqlite:sqlite-framework:2.1.0stable. ( aosp/1217729 ) - Added lint rules to ensure that a
foregroundServiceTypeis specified in theAndroidManifest.xmlwhen usingforegroundServiceTypes inForegroundInfo. ( aosp/1214207 , b/147873061 )
Version 2.3.0
Version 2.3.0
January 22, 2020
androidx.work:work-*:2.3.0 is released with no changes since 2.3.0-rc01 . Version 2.3.0 contains these commits .
Important changes since 2.2.0
- Support for long running or important work via
ListenableWorker#setForegroundAsync(). - Support for Worker Progress via
ListenableWorker#setProgressAsync(). - WorkManager now packages additional lint rules as part of the library which helps catch bugs early.
Version 2.3.0-rc01
۸ ژانویه ۲۰۲۰
androidx.work:work-*:2.3.0-rc01 is released. Version 2.3.0-rc01 contains these commits .
This release is identical to 2.3.0-beta02
رفع اشکالات
- The
work-testingartifact now defines anapidependency onwork-runtime-ktx. ( aosp/1194410 )
Version 2.3.0-beta02
۱۸ دسامبر ۲۰۱۹
androidx.work:work-*:2.3.0-beta02 is released. Version 2.3.0-beta02 contains these commits .
ویژگیهای جدید
- Added a better error message for non-recoverable SQLite exceptions. ( aosp/1185777 )
- Added a lint rule which ensures that the content provider
androidx.work.impl.WorkManagerInitializeris removed from theAndroidManifest.xmlwhen using on demand initialization. ( aosp/1167007 ) - Added a lint warning when
enqueue()is used for aPeriodicWorkRequestinstead ofenqueueUniquePeriodicWork(). ( aosp/1166032 )
API changes
-
ForegroundInfonow requires you to specify thenotificationIdto be used when usingListenableWorker.setForegroundAsync(). This is a breaking change. This allows you to run multiple long runningWorkers in parallel.WorkManageralso better manages lifetimes of the providedNotifications. ( b/145473554 , aosp/1181208 , asop/1181216 , asop/1183577 )
رفع اشکالات
- Fixed a bug in the AlarmManager implementation where alarms were not being cleaned up correctly. ( aosp/1156444 )
- Fixed a bug where an empty list of
WorkRequests would cause an incorrectWorkContinuationchain to be built. ( b/142835274 , aosp/1157051 )
Dependency changes
- WorkManager now uses Room 2.2.2.
Version 2.3.0-beta01
۲۰ نوامبر ۲۰۱۹
androidx.work:work-*:2.3.0-beta01 is released. Version 2.3.0-beta01 contains these commits .
ویژگیهای جدید
- Added a new lint rule which prevents developer errors due to incorrect implementation of
androidx.work.Configuration.Providerwhen using on-demand initialization. aosp/1164559
Version 2.3.0-alpha03
۲۳ اکتبر ۲۰۱۹
androidx.work:work-*:2.3.0-alpha03 is released. Version 2.3.0-alpha03 contains these commits .
ویژگیهای جدید
- Added
WorkManager.createCancelPendingIntent()API which makes it easy to cancelWorkRequests without having to register another component in theAndroidManifest.xml. This API makes it especially easy to cancelWorkRequests fromNotifications. We expect this to be paired with the new foreground APIs in 2.3.0. - WorkManager now depends on
androidx.room:*:2.2.0stable.
API changes
- Renamed
ForegroundInfo.getNotificationType()toForegroundInfo.getForegroundServiceType()to be more consistent with the underlying platform APIs. ( b/142729893 , aosp/1143316 )
رفع اشکالات
- Fixed a bug which is caused by an unnecessary call to
setTransactionSuccessful()outside of a transaction. This happens for rare migrations. ( b/142580433 , aosp/1141737 )
Version 2.3.0-alpha02
۹ اکتبر ۲۰۱۹
androidx.work:work-*:2.3.0-alpha02 is released. Version 2.3.0-alpha02 contains these commits .
ویژگیهای جدید
- WorkManager now supports running long running or important work that should be kept alive by the OS. For more information look at
ListenableWorker#setForegroundAsync()(orCoroutineWorker#setForeground()for Kotlin). ( aosp/1133636 )
API changes
- The
containsKeyAPI inDatais renamed tohasKeyWithValueOfType. The corresponding extension method in thektxlibrary has also been renamed. ( b/141916545 )
رفع اشکالات
- WorkManager schedules work fairly when the number of
WorkRequests enqueued approach scheduling limits . ( aosp/1105766 ) - WorkManager calls
ListenableWorker#onStopped()only if the work is not already completed. ( b/140055777 ) - WorkManager now removes progress information when a worker gets interrupted or reaches its terminal state. ( aosp/1114572 )
-
Datanow has a much more usefultoString()representation. ( b/140945323 ) -
Datanow has a betterequals()method. It also supportsdeepEqualsforArraytypes. ( b/140922528 ) - WorkManager now stores its internal database and preference files in a no backup directory. ( b/114808216 )
Version 2.3.0-alpha01
۲۲ آگوست ۲۰۱۹
androidx.work:work-*:2.3.September 5, 20190-alpha01 is released. The commits included in this version can be found here .
ویژگیهای جدید
-
ListenableWorkers can now set progress via thesetProgressAsync()API. Also added a correspondingsuspend-ingsetProgressAPI inCoroutineWorkerand asetProgressinRxWorkerwhich returns aSingle<Void>. With these new APIs Workers can convey progress information viaWorkInfowhich has a correspondinggetProgressAPI. ( b/79481554 ) -
Datahas acontainsKey()API which can be used to validate that input data toWorkers has keys with the expected type. ( b/117136838 ) -
Datacan now be serialized usingData.toByteArray()andData.fromByteArray(). Note that there are no versioning guarantees withDataso you should not persist it or use it for IPC between applications. They are only safe to be used between multiple processes of the same application. - Added the ability to specify an
InputMergerFactoryviaConfiguration.setInputMergerFactory. ( b/133273159 )
API changes
- WorkManager will throw an instance of
IllegalStateExceptionif aWorkerFactoryreturns an instance ofListenableWorkerwhich has been previously invoked. ( b/139554406 ) - Documentation updates around
ListenableFuturecancellation and theonStopped()callback inListenableWorker. ( b/138413671 )
رفع اشکالات
- The in-process Scheduler now ignores
WorkRequests with theidleconstraint. These requests are now only picked up byJobSchedulerwhen the device is actuallyidle. ( aosp/1089779 ) -
TestSchedulernow correctly uses the specifiedExecutorfor its internal task executor in tests. ( aosp/1090749 )
نسخه ۲.۲.۰
نسخه ۲.۲.۰
۱۵ آگوست ۲۰۱۹
androidx.work:work-*:2.2.0 is released. The commits included in this version can be found here .
This release is identical to androidx.work:work-*:2.2.0-rc01 .
Important Changes in 2.2.0 from 2.1.0
androidx.work:work-gcm:2.2.0 is a new Maven artifact which supports the use of GCMNetworkManager as a scheduler when Google Play Services is available for API levels <= 22. This is an optional dependency that helps with more reliable and performant background processing on older API versions. If your app uses Google Play Services, add this dependency to your gradle file to automatically get GCMNetworkManager support. If Play Services is not available, WorkManager will continue to fall back to AlarmManager on older devices.
Version 2.2.0-rc01
۳۰ ژوئیه ۲۰۱۹
androidx.work:work-*:2.2.0-rc01 is released. The commits included in this version can be found here .
رفع اشکالات
- Fixed a bug in the AlarmManager implementation that causes the Service to shutdown prematurely and resulting in a
RejectedExecutionExceptionin rare cases. ( aosp/1092374 ) ( b/138238197 ). - Added a workaround for a
NullPointerExceptionwhen usingJobSchedulerAPIs on some devices. ( aosp/1091020 ) ( b/138364061 ), ( b/138441699 )
Version 2.2.0-beta02
۱۹ ژوئیه ۲۰۱۹
androidx.work:work-*:2.2.0-beta02 is released. The commits included in this version can be found here .
رفع اشکالات
- Removed unintentional jacoco dependency that was introduced in
2.2.0-beta01.
Version 2.2.0-beta01
۱۷ ژوئیه ۲۰۱۹
androidx.work:work-*:2.2.0-beta01 is released. The commits included in this version can be found here .
ویژگیهای جدید
-
androidx.work:work-gcm:2.2.0-beta01is a new Maven artifact which supports the use of GCMNetworkManager as a scheduler when Google Play Services is available for API levels <= 22. This is an optional dependency that helps with more reliable and performant background processing on older API versions. If your app uses Google Play Services, add this dependency to your gradle file to automatically get GCMNetworkManager support. If Play Services is not available, WorkManager will continue to fall back to AlarmManager on older devices.
رفع اشکالات
- Fix for
IllegalArgumentExceptionwhen tracking network state on Nvidia Shield K1 tablets. ( aosp/1010188 )
نسخه ۲.۱.۰
نسخه ۲.۱.۰
۱۱ ژوئیه ۲۰۱۹
androidx.work:work-*:2.1.0 is released. This release is identical to androidx.work:work-*:2.1.0-rc01 .
Important changes since 2.0.1
-
work-runtime-ktxnow requires Java 8. If you run into any issues, you can add the following to yourbuild.gradle:kotlinOptions { jvmTarget = "1.8" } - Added on-demand initialization for WorkManager, which will create WorkManager only when referenced. b/127497100 To set up your project for on-demand initialization:
- Disable the automatic initializer .
- Implement
Configuration.Provideron your customApplicationobject. - Change all references of
WorkManager.getInstance()toWorkManager.getInstance(Context). As part of this change, we have deprecatedWorkManager.getInstance(). It is always safer to call the newWorkManager.getInstance(Context)replacement, even if you're not doing on-demand initialization.
-
PeriodicWorkRequests now support initial delays. You can use thesetInitialDelaymethod onPeriodicWorkRequest.Builderto set an initial delay. b/111404867 - Added the ability to delegate to one or more registered
WorkerFactorys usingDelegatingWorkerFactory. b/131435993 - Added the ability to customize the
Executorused by WorkManager for all its internal book-keeping viaConfiguration.Builder.setTaskExecutor. - Added the ability to create unit testable
WorkerandListenableWorkerclasses by usingTestWorkerBuilderandTestListenableWorkerBuilderin thework-testingartifact.- Note that
work-testingnow pulls in Kotlin as a dependency and includes several Kotlin extensions by default.
- Note that
- Added run attempt count to
WorkInfo. b/127290461 -
Datatypes can now store and retrieve bytes and byte arrays. This does NOT change the maximum size ofDataobjects. - WorkManager now depends on
Room 2.1.0, which should fix some database issues.
Version 2.1.0-rc01
۲۷ ژوئن ۲۰۱۹
androidx.work:work-*:2.1.0-rc01 is released. The commits included in this version can be found here .
رفع اشکالات
- Fixed a bug which would cause an application to crash when executing jobs with
JobSchedulerwhile a backup was in progress b/135858602 .
Version 2.1.0-beta02
۲۰ ژوئن ۲۰۱۹
androidx.work:work-*:2.1.0-beta02 is released. The commits included in this version can be found here .
رفع اشکالات
-
TestListenableWorkerBuildernow uses the correctWorkerFactorywhen creating instances ofListenableWorker. b/135275844 - Fixed a bug which caused drifts in the execution windows for
WorkRequests due to process death. b/135272196
Version 2.1.0-beta01
۱۳ ژوئن ۲۰۱۹
androidx.work:work-*:2.1.0-beta01 is released. The commits included in this version can be found here .
رفع اشکالات
- WorkManager now depends on
Room 2.1.0, which should fix some database issues. - Removed some startup disk I/O on the main thread.
- Fixed a potential deadlock in constraint tracking. b/134361006
- Preemptively cancelled invalid jobs attributed to WorkManager. b/134058261
- Added some defensive calls to JobScheduler APIs for misbehaving devices.
Version 2.1.0-alpha03
۵ ژوئن ۲۰۱۹
androidx.work:*:2.1.0-alpha03 is released.
رفع اشکالات
- Improved documentation for
PeriodicWorkRequests. -
WorkManagerTestInitHelpernow uses the correct background executor for tests. - Fixes for SQLite issues when dealing with large transactions on some devices. ( b/130182503 )
- WorkManager's dependencies are now more granular. ( b/133169148 ).
- Workaround OEM specific bugs in the implementation of
JobSchedulerwhen scheduling jobs using WorkManager. - Improvements in the AlarmManager based scheduler around service lifetimes that previously caused rare crashes. ( b/133313734 )
Version 2.1.0-alpha02
۱۶ مه ۲۰۱۹
WorkManager 2.1.0-alpha02 is released. This version contains several new APIs.
API Changes
PeriodicWorkRequests now support initial delays. You can use thesetInitialDelaymethod onPeriodicWorkRequest.Builderto set an initial delay. b/111404867Added the ability to delegate to one or more registered
WorkerFactorys usingDelegatingWorkerFactory. b/131435993Added the ability to customize the
Executorused by WorkManager for all its internal book-keeping viaConfiguration.Builder.setTaskExecutor.Improved documentation around
WorkRequest.keepResultsForAtLeast( b/130638001 ), on-demand initialization, andPeriodicWorkRequest.Builder( b/131711394 ).
Version 2.1.0-alpha01
۲۴ آوریل ۲۰۱۹
WorkManager 2.1.0-alpha01 is released. This version contains several new APIs. Please note that starting with this version, there will be new features that won't get backported to the 1.x release. We recommend switching to 2.x.
API Changes
- Added on-demand initialization for WorkManager, which will create WorkManager only when referenced. b/127497100 To set up your project for on-demand initialization:
- Disable the automatic initializer .
- Implement
Configuration.Provideron your customApplicationobject. - Change all references of
WorkManager.getInstance()toWorkManager.getInstance(Context). As part of this change, we have deprecatedWorkManager.getInstance(). It is always safer to call the newWorkManager.getInstance(Context)replacement, even if you're not doing on-demand initialization.
- Added the ability to create unit testable
WorkerandListenableWorkerclasses by usingTestWorkerBuilderandTestListenableWorkerBuilderin thework-testingartifact.- Note that
work-testingnow pulls in Kotlin as a dependency, but also includes several Kotlin extensions by default.
- Note that
- Added run attempt count to
WorkInfo. b/127290461 -
Datatypes can now store and retrieve bytes and byte arrays. This does NOT change the maximum size ofDataobjects. - Deprecated
CoroutineWorker.coroutineContext. This field was incorrectly typed as aCoroutineDispatcher; you should no longer need it as you can go to the desired coroutineContext yourself in the body of the suspending function. -
RxWorker.createWork()andRxWorker.getBackgroundScheduler()are now annotated with@NonNullreturn types.
نسخه ۲.۰.۱
نسخه ۲.۰.۱
۹ آوریل ۲۰۱۹
WorkManager 2.0.1 is released. This release is identical to 2.0.1-rc01 .
Version 2.0.1-rc01
۳ آوریل ۲۰۱۹
WorkManager 2.0.1-rc01 is released. This version contains some bug fixes. For legacy 1.x users, some of these changes also appear in 1.0.1-rc01 .
رفع اشکالات
- Robolectric tests now operate properly with WorkManager. b/122553577
- Fixed an edge case crash with constraints tracking not being cleaned up on pre-JobScheduler APIs. b/129226383
- Fixed a
StackOverflowErrordealing with long chains of work. b/129091233 - Updated documentation for
PeriodicWorkRequests to indicate that flex time is not supported on API 23. - Fixed some broken links in the Kotlin documentation.
نسخه ۲.۰.۰
نسخه ۲.۰.۰
۲۰ مارس ۲۰۱۹
WorkManager 2.0.0 is released. This version is identical to 2.0.0-rc01 and is the AndroidX version of 1.0.0 stable with AndroidX dependencies. We recommend targeting this version instead of the legacy 1.x versions. All active development will target 2.x and 1.x will only receive critical bug fixes for a limited time.
Version 2.0.0-rc01
۷ مارس ۲۰۱۹
WorkManager 2.0.0-rc01 is released. This version is identical to 1.0.0 stable but has AndroidX dependencies. Once this reaches 2.0.0 stable, you should include this version and the legacy 1.x versions will only receive some critical bug fixes. All active development will target 2.x.
Pre-AndroidX Dependencies
Reference docs: Java
گرووی
dependencies { def work_version = "1.0.1" // (Java only) implementation "android.arch.work:work-runtime:$work_version" // Kotlin + coroutines implementation "android.arch.work:work-runtime-ktx:$work_version" // optional - RxJava2 support implementation "android.arch.work:work-rxjava2:$work_version" // optional - Test helpers androidTestImplementation "android.arch.work:work-testing:$work_version" }
کاتلین
dependencies { val work_version = "1.0.1" // (Java only) implementation("android.arch.work:work-runtime:$work_version") // Kotlin + coroutines implementation("android.arch.work:work-runtime-ktx:$work_version") // optional - RxJava2 support implementation("android.arch.work:work-rxjava2:$work_version") // optional - Test helpers androidTestImplementation("android.arch.work:work-testing:$work_version") }
نسخه ۱.۰.۱
نسخه ۱.۰.۱
۹ آوریل ۲۰۱۹
WorkManager 1.0.1 is released. This release is identical to 1.0.1-rc01 .
Please note that we strongly encourage users to update to WorkManager 2.x, as there will be very few updates to the 1.x branch moving forward. New APIs will also not be released for the 1.x library.
Version 1.0.1-rc01
۲ آوریل ۲۰۱۹
WorkManager 1.0.1-rc01 is released. This version contains some bug fixes.
رفع اشکالات
- Robolectric tests now operate properly with WorkManager. b/122553577
- Fixed an edge case crash with constraints tracking not being cleaned up on pre-JobScheduler APIs. b/129226383
- Fixed a
StackOverflowErrordealing with long chains of work. b/129091233
نسخه ۱.۰.۰
نسخه ۱.۰.۰
۵ مارس ۲۰۱۹
This is WorkManager's 1.0.0 stable release. This version of WorkManager is identical to 1.0.0-rc02.
Version 1.0.0-rc02
۲۱ فوریه ۲۰۱۹
This is the second release candidate for WorkManager's 1.0.0 stable release. This release contains two bug fixes.
رفع اشکالات
Workers are now correctly scheduled after an application crash. b/124546316Workers that throw an uncheckedExceptionare now correctly marked asFAILEDand no longer crash the app process.
Version 1.0.0-rc01
۱۴ فوریه ۲۰۱۹
This is a release candidate for WorkManager's 1.0.0 stable release. This release contains one bug fix.
رفع اشکالات
- The AlarmManager based implementation now correctly respects
flexwindows for PeriodicWorkRequests. b/124274584
Version 1.0.0-beta05
۶ فوریه ۲۰۱۹
This release contains some bug fixes.
رفع اشکالات
- Fixed a case where
JobScheduler.getPendingJob(...)was used on API 23. b/123893059 - Fixed a
NullPointerExceptionon devices running Android 5.1 (API level 22) or lower. b/123835104
Version 1.0.0-beta04
۴ فوریه ۲۰۱۹
This release contains some bug fixes.
رفع اشکالات
- Improved scheduling of PeriodicWork for the AlarmManager based implementation.
- Fixed a case where WorkManager failed to correctly track constraints when using the AlarmManager based implementation. b/123379508
- Fixed a case when WorkManager failed to retry work on process death when using the AlarmManager based implementation. b/123329850
- Fixed a case which would cause WorkManager to leak Wakelocks when using the AlarmManager based implementation.
Version 1.0.0-beta03
۲۵ ژانویه ۲۰۱۹
This release contains some bug fixes.
رفع اشکالات
- We introduced a regression
1.0.0-beta02that was causing work to not execute properly in some situations. b/123211993 - Fixed a case where work wasn't properly honoring backoff timing. b/122881597
- Fixed a
ConcurrentModificationExceptionon devices running Android 5.1 (API or) or lower. This is a continuation of the fix in1.0.0-beta02. b/121345393 - Added
exported=falsefor some components in our manifest that were missing this annotation. - Included information about how WorkManager interacts with the OS in the package-level documentation.
Version 1.0.0-beta02
۱۵ ژانویه ۲۰۱۹
This release contains some bug fixes.
رفع اشکالات
- Fixed an edge case where periodic work could run more than once per interval on devices running Android 6.0 (API level 23). b/121998363
- Fixed a
ConcurrentModificationExceptionon devices running Android 5.1 (API level 22) or lower. b/121345393 - Fixed erroneous execution of work when Constraints aren't met on devices running Android 5.1 (API level 22) or lower. b/122578012
- Optimized work completion handling to be faster in some edge cases. b/122358129
- Added a change to address potential race conditions among multiple instances of
LiveDatathat WorkManager uses. - Moved to use
Roomdependency1.1.1instead of1.1.1-rc01; these versions are identical. b/122578011
Version 1.0.0-beta01
۱۹ دسامبر ۲۰۱۸
This release contains no API changes; moving forward, WorkManager is expected to stay API stable until the next version unless there is a critical problem. This release contains some bug fixes.
رفع اشکالات
- Previously-cancelled children of successfully completed parent work will no longer run. b/120811767
- Properly initialized logging classes (primarily surfaced during tests).
Version 1.0.0-alpha13
۱۲ دسامبر ۲۰۱۸
This release contains a minor API change that will be helpful for some Kotlin users.
API Changes
-
androidx.work.Resulthas been moved to be an inner class ofListenableWorker. This prevents refactoring conflicts with Kotlin's top-levelResultclass. This is a breaking API change. b/120564418
Breaking API Changes
-
androidx.work.Resulthas been moved to be an inner class ofListenableWorker.
Version 1.0.0-alpha12
۵ دسامبر ۲۰۱۸
This release contains some breaking API changes; please see the Breaking API Changes section below. This version is likely to be released as our first beta. alpha12 also contains extensive documentation updates.
API Changes
- A new artifact,
work-rxjava2, introducesRxWorker. This is aListenableWorkerthat expects aSingle<Payload>. - Support for Firebase JobDispatcher has been removed because of its impending deprecation. This means that the
work-firebaseartifact will no longer be updated as we head into beta. We will be looking into adding an alternative in the future. - Combined
PayloadintoResult.Resultis now a "sealed class" with three concrete implementations, which you can obtain viaResult.success()(orResult.success(Data)),Result.failure()(orResult.failure(Data)), andResult.retry(). YourListenableFutures now resultResultinstead ofPayload.Workers don't have getter and setter methods for outputData. This is a breaking change. - Added
Constraints.Builder.setTriggerContentMaxDelay(long, TimeUnit)andConstraints.Builder.setTriggerContentUpdateDelay(long, TimeUnit)and variants to better support slow triggering content URIs. b/119919774 - Added
WorkRequest.Builder.setBackoffCriteria(BackoffPolicy, Duration)variant. This method requires API 26. - Added
Operation.await()andListenableFuture.await()Kotlin extension methods. - Renamed
Operation.getException()toOperation.getThrowable(). This is a breaking change. - The
ContentUriTriggersclass and methods referencing it are no longer available for public usage. This is a breaking change. - Removed the rest of the varargs methods in
WorkManager,WorkContinuation, andOneTimeWorkRequestto streamline the API. To fix any build problems, you can wrap your existing varargs withArrays.asList(...). We still include single-argument versions of each method. This is a breaking change. - Removed
WorkContinuation.combine(OneTimeWorkRequest, *)variants. They were presenting a confusing API; the existingcombinemethods are more understandable. This is a breaking change.
رفع اشکالات
- Pre-Marshmallow implementations are now more reliable in recovering from process death of an already-executing task.
-
LiveDatathat is observed viaobserveForeveris tracked via WorkManager. This is a backport of a Room library fix. b/74477406 -
Data.Builder.build()now throws an exception if the serialized object exceeds its maximum size. This previously would only happen on a background thread where you couldn't properly handle it. - Further distinguished stopped vs. cancelled work;
getWorkInfoById()will return aWorkInfowith theCANCELLEDStateduringListenableWorker.onStopped(). - Treat
nullResults as failures inListenableWorker. b/120362353 - Speculative fix for Shield Tablets running API 24 that sometimes threw an
IllegalArgumentException. b/119484416
Breaking API Changes
- Support for Firebase JobDispatcher has been removed because of its impending deprecation. This means that the
work-firebaseartifact will no longer be updated as we head into beta. We will be looking into adding an alternative in the future. - Combined
PayloadintoResult.Resultis now a "sealed class" with three concrete implementations, which you can obtain viaResult.success()(orResult.success(Data)),Result.failure()(orResult.failure(Data)), andResult.retry(). YourListenableFutures now resultResultinstead ofPayload.Workers don't have getter and setter methods for outputData. - Added
Operation.await()andListenableFuture.await()Kotlin extension methods. - Renamed
Operation.getException()toOperation.getThrowable(). - The
ContentUriTriggersclass and methods referencing it are no longer available for public usage. - Removed the rest of the varargs methods in
WorkManager,WorkContinuation, andOneTimeWorkRequestto streamline the API. To fix any build problems, you can wrap your existing varargs withArrays.asList(...). We still include single-argument versions of each method. - Removed
WorkContinuation.combine(OneTimeWorkRequest, *)variants. They were presenting a confusing API; the existingcombinemethods are more understandable.
Version 1.0.0-alpha11
۸ نوامبر ۲۰۱۸
This release contains many changes that will become stable API at beta . There are breaking API changes in this release; please see the Breaking API Changes section below.
API Changes
-
work-runtime-ktxintroduces a newCoroutineWorker. -
WorkStatushas been renamed toWorkInfo. All correspondinggetStatusmethod variants have been renamed to the correspondinggetWorkInfovariants. This is a breaking change. -
ListenableWorker.onStopped()no longer accepts has a boolean argument representing if theWorkRequestwas cancelled.WorkManagerno longer makes this distinction. This is a breaking change. -
androidx.work.testpackage has been renamed toandroidx.work.testingpackage. This is a breaking change. - Setters on
Constraintsare no longer a part of the public API. This is a breaking change. -
WorkerParameters.getTriggeredContentUris()andWorkerParameters.getTriggeredContentAuthorities()previously returned arrays. Now these methods return Collections. This is a breaking change. -
ListenableWorker.onStartWork()is renamed toListenableWorker.startWork(). This is a breaking change. - The constructor for
WorkStatusis no longer a part of the public API. This is a breaking change. -
Configuration.getMaxJobSchedulerID()andConfiguration.getMinJobSchedulerID()are renamed toConfiguration.getMinJobSchedulerId()andConfiguration.getMaxJobSchedulerId()respectively. This is a breaking change. - Added a lot of
@NonNullannotations to the public API to improve ergonomics of the API. - Add
WorkManager.enqueueUniqueWork()API to enqueue uniqueOneTimeWorkRequests without having to create aWorkContinuation. - All variants of
enqueueandcancelmethods onWorkManagernow return a newOperationtype. This is a breaking change. - All variants of
enqueueno longer accept varargs forWorkRequests. This is a breaking change. Use Collections instead. You can useArrays.asList()to modify existing code. We did this to reduce the API surface and method count. - Attempting to
initializeWorkManagermore than once per process will now result in anIllegalStateException. This is a breaking change.
رفع اشکالات
-
WorkRequest.Builders in thework-runtime-ktxartifact now useListenableWorkers. Fixes b/117666259 - Ensure the next run time for
PeriodicWorkis in the future. Fixes b/118204399 - Remove potential disk I/O when using WorkManager on app startup. Fixes b/117796731
- Fix a race condition in
WorkConstraintsTracker. Fixes android-workmanager/issues/56
Breaking API Changes
-
WorkStatushas been renamed toWorkInfo. All correspondinggetStatusmethod variants have been renamed to the correspondinggetWorkInfovariants. -
ListenableWorker.onStopped()no longer accepts has a boolean argument representing if theWorkRequestwas cancelled.WorkManagerno longer makes this distinction. -
androidx.work.testpackage has been renamed toandroidx.work.testingpackage. - Setters on
Constraintsare no longer a part of the public API. -
WorkerParameters.getTriggeredContentUris()andWorkerParameters.getTriggeredContentAuthorities()previously returned arrays. Now these methods return Collections. -
ListenableWorker.onStartWork()is renamed toListenableWorker.startWork(). - The constructor for
WorkStatusis no longer a part of the public API. -
Configuration.getMaxJobSchedulerID()andConfiguration.getMinJobSchedulerID()are renamed toConfiguration.getMinJobSchedulerId()andConfiguration.getMaxJobSchedulerId()respectively. - All variants of
enqueueandcancelmethods onWorkManagernow return a newOperationtype. - All variants of
enqueueno longer accept varargs forWorkRequests. - Attempting to
initializeWorkManagermore than once per process will now result in anIllegalStateException.
Version 1.0.0-alpha10
۱۱ اکتبر ۲۰۱۸
This release supports developer-controlled asynchronous work. There are breaking API changes in this release; please see the Breaking API Changes section below.
We anticipate that WorkManager is entering the final phases of its alpha period. We expect to be API stable in beta, so please take some time to file your feedback on our issue tracker.
API Changes
- Removed all previously
deprecatedmethods and classes, notably the defaultWorkerconstructor. This is a breaking API change. - Renamed
NonBlockingWorkertoListenableWorker, which is now an unhidden public class and ready for usage.-
ListenableWorkerprovides access to one abstract method,ListenableFuture<Payload> onStartWork()which is called on the main thread. It is up to you to start and process work asynchronously. When finished, you should update theListenableFutureappropriately. Reference implementations ofListenableFutures are provided in theFuturespackage inalpha02(see below theWorkManagersection). -
WorkerextendsListenableWorkerand still operates as before, with an abstractResult doWork()method. - Shuffled some methods and members from
WorkertoListenableWorker. - We shall soon provide reference implementations for
ListenableWorkers that use Kotlin coroutines (once the stable versions are released) and RxJava2.
-
- The interface
WorkerFactoryand the concrete implementationDefaultWorkerFactoryhave been merged into an abstract class calledWorkerFactory. The implementation ensures that the default reflection-based behavior is called as a last-ditch effort for any user-createdWorkerFactoryinstances. This is a breaking change. - Removed
WorkManager.synchronous()andWorkContinuation.synchronous()and all related methods. AddedListenableFuture<Void>as the return type of many methods in the API. This is a breaking API change.- You can now synchronously get and observe by using
ListenableFutures. For example,WorkManager.enqueue()used to returnvoid; it now returns aListenableFuture<Void>. You can callListenableFuture.addListener(Runnable, Executor)orListenableFuture.get()to run code once the operation is complete. - Note that these
ListenableFutures do not tell you if the operation succeeded or failed; only that they finished. You will still need to chain WorkManager methods to find out this information. - We ignore
cancel()calls on these objects, as they are confusing and hard to reason about (are you cancelling the operation or the resulting work?). This is within theFutures contract. - To maintain parity with the synchronous
getStatus*methods, we have providedListenableFuturevariants, and renamed the existing ones that returnedLiveDatato explicitly have "LiveData" as part of the name (for example,getStatusesByIdLiveData(UUID)). This is a breaking API change.
- You can now synchronously get and observe by using
رفع اشکالات
- Fixed the known issue from alpha09 regarding duplicate
androidx-annotations.profiles. You may remove the workaround from the previous release notes by deletingexclude 'META-INF/proguard/androidx-annotations.pro'from your gradle file. - Added proguard configurations to keep new
Workerconstructor. b/116296569 - Fix potential
NullPointerExceptionin a race condition where work wasREPLACEd. b/116253486 and b/116677275 -
WorkContinuation.combine()now accepts one or moreWorkContinuations instead of two or more. b/117266752
Breaking API Changes
- Removed all previously
deprecatedmethods and classes, notably the defaultWorkerconstructor. - The interface
WorkerFactoryand the concrete implementationDefaultWorkerFactoryhave been merged into an abstract class calledWorkerFactory. - Removed
WorkManager.synchronous()andWorkContinuation.synchronous(). -
WorkManager.getStatus*()methods now returnListenableFutures.WorkManager.getStatus*LiveData()returnLiveDatas.
Version 1.0.0-alpha09
۱۹ سپتامبر ۲۰۱۸
مشکل شناخته شده
If you run into the following issue: "More than one file was found with OS independent path 'META-INF/proguard/androidx-annotations.pro'", please put the following in your gradle file as a temporary workaround while we fix the issue in alpha10:
گرووی
android { packagingOptions { exclude 'META-INF/proguard/androidx-annotations.pro' } }
کاتلین
android { packagingOptions { exclude("META-INF/proguard/androidx-annotations.pro") } }
رفع اشکالات
- Added another fix that was needed for the "100 jobs" error. b/115560696
- Added some fixes for foreign key constraint errors due to race conditions. b/114705286
- Delegated
ConstraintTrackingWorker.onStopped(boolean)calls to the underlyingWorker. b/114125093 - Enforce correct minimum backoff delay for Firebase JobDispatcher. b/113304626
- Improved threading guarantees internal to the library.
- Correct potential issue with deduping of
LiveDatainternally.
API Changes
- You can now create your own
Workerinstances at runtime by specifying aWorkerFactoryas part of theWorkManager.Configuration. The fallback factory isDefaultWorkerFactory, which matches behavior of previous versions of WorkManager.- The default constructors for
WorkerandNonBlockingWorkerare now marked as deprecated. Please use the new constructor (Worker(Context, WorkerParameters)) and callsuper(Context, WorkerParameters); future versions of WorkManager will remove the default constructor.
- The default constructors for
- We have started using the new
ListenableFutureartifact internally (free of Guava dependencies). We will introduce ListenableFutures to the API in upcoming releases. This change will support the eventual unhiding ofNonBlockingWorker. - Add ability to trigger timed work in
TestDriverviaTestDriver.setInitialDelayMet(UUID)andTestDriver.setPeriodDelayMet(UUID). b/113360060
تغییرات اساسی
- The default
WorkerandNonBlockingWorkerconstructors are deprecated. Please migrate to the new constructor ASAP. Future versions will remove the default constructor.
Version 1.0.0-alpha08
۲۷ آگوست ۲۰۱۸
رفع اشکالات
- Explicitly labelled WorkManager components as direct boot unaware so they don't fire up during direct boot. In the future, we will provide a version of WorkManager that is direct boot-aware. b/112665532
- Fixed an issue where retried work was not running. b/112604021
- Fixed periodic work not executing repeatedly (related to the above issue). b/112859683
- Honored backoff policies when the app process is already running.
- Corrected exception messages in
Datato indicate the limit is 10KB. - Lowered maximum value of
Configuration.setMaxSchedulerLimit(int)to 50 to account for some latency inJobSchedulerprocessing completion. b/112817355
Version 1.0.0-alpha07
۱۶ آگوست ۲۰۱۸
رفع اشکالات
- Fixed a potential SQL query with negative limits that could return an unbounded number of results.
- Work that has finished execution now correctly cancels all pending copies of that work in other Schedulers. This led to exceeding the
JobSchedulerjobs limit. b/111569265 - Fixed a
ConcurrentModificationExceptioninConstraintTracker. b/112272753 - Changed return type annotations of
Data.getBooleanArray(String)andData.getIntArray(String)to@Nullableinstead of@NonNull. b/112275229
API Changes
-
Workernow extends a new class,NonBlockingWorker. This does not affect any current usage. In the future,NonBlockingWorkerwill become a fully supported entity for custom threading solutions. - Changed return type annotations of
Data.getBooleanArray(String)andData.getIntArray(String)to@Nullableinstead of@NonNull. b/112275229 - Kotlin extensions: deprecated
Map.toWorkData()and added a top-levelworkDataOf(vararg Pair<String, Any?>)to be more consistent with existing APIs.
Version 1.0.0-alpha06
۱ آگوست ۲۰۱۸
رفع اشکالات
- Prevent a database lock when scheduling work. b/111801342
- Fix a bug which causes
PeriodicWorkto not run on schedule when in Doze mode. b/111469837 - Fix a race condition when tracking constraints which causes
WorkManagerto crash. googlecodelabs/android-workmanager/issues/56 - Create unique
WorkRequests when usingWorkRequest.Builder#build(). b/111408337 - Enable the use of
RescheduleReceiveronly when there areWorkRequests that need it. b/111765853
Version 1.0.0-alpha05
۲۴ ژوئیه ۲۰۱۸
API Changes
-
WorkManager.getInstance()is now annotated with@NonNullinstead of@Nullable. Instead, if the singleton isn't properly initialized in cases of manual initialization, the method will throw anIllegalStateException. This is a breaking API change. - Added a new API,
Configuration.Builder.setMinimumLoggingLevel(int), which can control WorkManager verbosity. By default, WorkManager logsLog.INFOand above. - Changed signature of
Data.getString()so it no longer takes a default value (it is implicitlynull). This is a breaking API change. - Marked some methods needed only for internal usage as
@hide. This includes theConstraintsconstructor,Data.toByteArray(), andData.fromByteArray(byte[]). This is a breaking API change.
رفع اشکالات
- WorkManager no longer executes work during known cases of auto-backup. This could have resulted in a crash. b/110564377
- Fixed double-scheduling of
PeriodicWorkRequests when usingJobScheduler. b/110798652 - Fixed an issue with
PeriodicWorkRequests not executing correctly after device doze. b/111469837 - Fixed an issue with initial delays when using Firebase JobDispatcher. b/111141023
- Fixed some potential race conditions and timing issues.
- Correctly freed up
BroadcastReceivers that were no longer needed. - Optimized rescheduling performance when apps restart after being force closed.
- Allowed
TestScheduler.setAllConstraintsMet(UUID)to be called before or after enqueuing the givenWorkRequest. b/111238024
تغییرات اساسی
-
WorkManager.getInstance()is now annotated with@NonNullinstead of@Nullable. - Changed signature of
Data.getString()so it no longer takes a default value (it is implicitlynull). - Marked some methods needed only for internal usage as
@hide. This includes theConstraintsconstructor,Data.toByteArray(), andData.fromByteArray(byte[]).
Version 1.0.0-alpha04
۲۶ ژوئن ۲۰۱۸
رفع اشکالات
-
PeriodicWorkRequests are now correctly rescheduled when using theAlarmManagerbased implementation. - Fixed a potential ANR when rescheduling all workers after a force stop or a reboot. b/110507716
- Added nullability annotations to various WorkManager APIs. b/110344065
- Log uncaught exceptions that occur during Worker execution. b/109900862
- Allowed destructive database migrations in case you decide to roll back to an older version of WorkManager. b/74633270
- Fixed a migration crash if creating duplicate implicit tags. This is a very rare issue that occurred only if you used the same implicit tag format yourself.
Version 1.0.0-alpha03
۱۹ ژوئن ۲۰۱۸
رفع اشکالات
Fixed a race condition in the
AlarmManagerbased implementation. b/80346526 .Fixed duplicate jobs when using
JobSchedulerafter a device reboot.Jobs with Content URI triggers now persist across reboots. b/80234744
Documentation updates. b/109827628 , b/109758949 , b/80230748
Fixed a crash when re-enqueuing a
WorkRequest. b/109572353 .Fixed Kotlin compiler warnings when using the
work-runtime-ktxdependency.WorkManager now uses
Roomversion1.1.1-rc1.
API Changes
- Added
getStatusesSync(), the synchronous version ofWorkContinuation.getStatuses(). -
Workerhas the ability to distinguish between user-initiated cancellation and temporary os-requested stopping.Worker.isStopped()returnstrueif any kind of stop has been requested.Worker.isCancelled()returnstruewhen the work has been explicitly cancelled. b/79632247 - Add support for JobParameters#getNetwork() on API 28. This is exposed via
Worker.getNetwork(). - Added
Configuration.Builder.setMaxSchedulerLimit(int maxSchedulerLimit)so you can enforce how many jobs can be sent toJobSchedulerorAlarmManager. This helps preventWorkManagerfrom taking all your availableJobSchedulerslots. - Added
Configuration.setJobSchedulerJobIdRange(int minJobSchedulerId, int maxJobSchedulerId)which helps define a range ofJobSchedulerjob ids safe forWorkManagerto use. b/79996760 -
Worker.getRunAttemptCount()returns the current run count for a givenWorker. b/79716516 -
WorkManager.enqueueUniquePeriodicWork(String uniqueWorkName, ExistingPeriodicWorkPolicy existingPeriodicWorkPolicy, PeriodicWorkRequest periodicWork)allows you to enqueue a uniquePeriodicWorkRequests. b/79600647 -
WorkManager.cancelAllWork()cancels allWorkers. Libraries that depend onWorkManagercan query when this method was called last by usingWorkManager.getLastCancelAllTimeMillis()for additional cleanup of internal state. - Added
WorkManager.pruneWork()to remove completed jobs from the internal database. b/79950952 , b/109710758
تغییرات رفتاری
- Added an implicit tag for all
WorkRequests, which is the fully qualified class name for theWorker. This allows the ability to removeWorkRequests withouttags or when theidis not available. b/109572351
تغییرات اساسی
- Renamed
Worker.WorkerResulttoWorker.Result. -
Worker.onStoppednow has an additionalisCancelledparameter which is set totruewhen theWorkerhas explicitly been cancelled.
Version 1.0.0-alpha02
۲۴ مه ۲۰۱۸
رفع اشکالات
- Fixed a
NullPointerExceptiononState.isFinished(). b/79550068 - Fixed an issue which caused
Workers to be rescheduled onApplication.onCreate(). b/79660657 - Fixed an issue where you could schedule more work than is allowed by the OS. b/79497378
- Moved cleanup of wake locks associated with
Workers to the background thread. - The
AlarmManagerimplementation now correctly cleans up when all pending work is complete. - Fixed cleanup SQL queries which affected non-English locales. b/80065360
- Added support for
floats inData. b/79443878 -
Data.Builder.putAll()now returns an instance of theBuilder. b/79699162 - More javadoc and fixes in documentation. b/79691663
API Changes
-
Workers can react to being stopped.Worker.isStopped()can be used to check if aWorkerhas been stopped.Worker.onStopped()can be used to perform lightweight cleanup operations. -
Worker.getTags()API returns aSetof tags associated with theWorker. - Added
javax.time.Durationoverloads for APIs which take a combination of duration andTimeUnits. This is guarded by@RequiresApi(26). -
WorkManagerextensions have moved from theandroidx.work.ktxpackage to theandroidx.workpackage. The old extensions are deprecated and will be removed in a future version. -
Configuration.withExecutor()is deprecated. UseConfiguration.setExecutor()instead.
Version 1.0.0-alpha01
۸ مه ۲۰۱۸
WorkManager simplifies scheduling and execution of guaranteed, constraint-aware background work. This initial release is 1.0.0-alpha01 .