مدیر کار

WorkManager API برنامه ریزی کارهای ناهمزمان و قابل تعویق را که باید به طور قابل اعتماد اجرا شوند را آسان می کند. این APIها به شما امکان می‌دهند یک کار ایجاد کنید و آن را به WorkManager بسپارید تا در صورت برآورده شدن محدودیت‌های کاری اجرا شود.
آخرین به روز رسانی انتشار پایدار کاندید را آزاد کنید نسخه بتا انتشار آلفا
8 اکتبر 2025 2.10.5 2.11.0-rc01 - -

اعلام وابستگی ها

برای افزودن وابستگی به WorkManager، باید مخزن Google Maven را به پروژه خود اضافه کنید:

وابستگی‌های مصنوعات مورد نیاز خود را در فایل build.gradle برای برنامه یا ماژول خود اضافه کنید:

شیار

dependencies {
    def work_version = "2.10.5"

    // (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.10.5"

    // (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")
}

برای اطلاعات در مورد استفاده از پسوندهای Kotlin، به مستندات ktx مراجعه کنید.

برای اطلاعات بیشتر درباره وابستگی‌ها، به افزودن وابستگی‌های ساخت مراجعه کنید.

بازخورد

بازخورد شما به بهتر شدن Jetpack کمک می کند. اگر مسائل جدیدی کشف کردید یا ایده هایی برای بهبود این کتابخانه دارید، به ما اطلاع دهید. لطفاً قبل از ایجاد کتابخانه جدید، به مسائل موجود در این کتابخانه نگاهی بیندازید. با کلیک کردن روی دکمه ستاره می توانید رای خود را به یک موضوع موجود اضافه کنید.

یک شماره جدید ایجاد کنید

برای اطلاعات بیشتر به مستندات ردیاب مشکل مراجعه کنید.

نسخه 2.11

نسخه 2.11.0-rc01

08 اکتبر 2025

androidx.work:work-*:2.11.0-rc01 منتشر شد. نسخه 2.11.0-rc01 حاوی این commit ها است.

نسخه 2.11.0-beta01

24 سپتامبر 2025

androidx.work:work-*:2.11.0-beta01 منتشر شد. نسخه 2.11.0-beta01 حاوی این تعهدات است.

تغییرات API

  • stopRunningWorkWithReason به WorkManager TestDriver اضافه کنید. ( Ie53b2 , b/439955564 )

رفع اشکال

  • رفع توقف سرویس پیش زمینه در صورت وجود دستورات معلق ( Iae822 , b/432069314 )
  • رفع مشکل از راه دور کارگر کوروتین در بازکردن سرویس راه دور ( I842f2 , b/247113322 )

نسخه 2.11.0-alpha01

27 آگوست 2025

androidx.work:work-*:2.11.0-alpha01 منتشر شد. نسخه 2.11.0-alpha01 حاوی این commit ها است.

تغییرات API

  • minSdk از API 21 به API 23 به روز شده است ( Ibdfca , b/380448311 , b/435705964 , b/435705223 )
  • API setRemoteSessionTimeoutMillis در سازنده WorkManager's Configuration اضافه شده است تا پیکربندی مدت زمانی که یک جلسه RemoteWorkManager از آخرین استفاده از آن زنده است را فعال کند. ( Ib23c8 )
  • یک API آزمایشی در WorkRequest.Builder اضافه کنید تا زمانی که کار توسط سیستم قطع می‌شود، عقب‌نشینی اعمال شود. ( Ie2dc7 , b/335513480 )
  • API آزمایشی را اضافه کنید تا در یک کلاس کارگر متفاوت به TestListenableWorkerBuilder نسبت به آنچه که برای پشتیبانی از پیاده سازی های سفارشی WorkerFactory ساخته شده است ( If6bff , b/389154854 ) اضافه کنید

رفع اشکال

  • قابلیت‌های کش شبکه در SharedNetworkCallback برای جلوگیری از IPC‌های غیرضروری ( Ie4027 , b/427115602 )
  • مشکلی را در ارزیابی محدودیت شبکه برطرف کنید که در آن موارد کاری بعد از اولی قابلیت‌های فعلی شبکه را دریافت نمی‌کنند و در عوض پس از مهلت زمانی به ConstraintsNotMet ضربه می‌زنند ( Ib6a66 , b/427115602 )

نسخه 2.10

نسخه 2.10.5

24 سپتامبر 2025

androidx.work:work-*:2.10.5 منتشر شد. نسخه 2.10.5 شامل این commit ها است.

رفع اشکال

  • رفع توقف سرویس پیش زمینه در صورت وجود دستورات معلق ( Iae822 , b/432069314 )

نسخه 2.10.4

10 سپتامبر 2025

androidx.work:work-*:2.10.4 منتشر شد. نسخه 2.10.4 حاوی این commit ها است.

رفع اشکال

  • رفع مشکل RemoteCoroutineWorker که سرویس راه دور را باز نمی کند ( I842f2 , b/247113322 )

نسخه 2.10.3

30 جولای 2025

androidx.work:work-*:2.10.3 منتشر شد. نسخه 2.10.3 شامل این commit ها است.

رفع اشکال

  • مشکلی را برطرف کنید که در آن کارگران با محدودیت‌های شبکه مشابه با کارگر قبلی گزارش می‌دهند که محدودیت‌هایشان برآورده نشده است. ( b/427115602 ).

نسخه 2.10.2

18 ژوئن 2025

androidx.work:work-*:2.10.2 منتشر شد. نسخه 2.10.2 حاوی این commit ها است.

رفع اشکال

  • مشکلی را هنگام تداوم کارگران با درخواست‌های شبکه و قابلیت‌های پیش‌فرض برطرف کنید که منجر به اضافه شدن مجدد قابلیت‌های حذف شده و باعث بدرفتاری کارگران با محدودیت‌های شبکه می‌شود. ( b/409716532 )
  • رفع اشکالی که باعث می‌شود کارگرانی که دارای محدودیت‌های شبکه هستند به‌دلیل برآورده نشدن محدودیت‌ها، به‌سرعت اجرا نشوند، حتی اگر شبکه و قابلیت‌ها در دسترس بودند. ( b/423403088 )

نسخه 2.10.1

23 آوریل 2025

androidx.work:work-*:2.10.1 منتشر شد. نسخه 2.10.1 شامل این commit ها است.

رفع اشکال

  • امکان حذف TooManyRequestsException از ثبت نام NetworkCallback توسط WorkManager که برای ردیابی محدودیت ها استفاده می شود را کاهش دهید. ( b/231499040 , b309d5 ).

نسخه 2.10.0

30 اکتبر 2024

androidx.work:work-*:2.10.0 منتشر شد. نسخه 2.10.0 شامل این commit ها است.

تغییرات قابل توجه از نسخه 2.9.1

  • برچسب‌های ردیابی از WorkManager به Jobs اضافه شده است که درک «adb shell dumpsys jobscheduler» را بسیار ساده‌تر می‌کند، زیرا حاوی نام Worker در حال اجرا است. بخش‌های Trace نیز در اطراف بخش‌های کلیدی WorkManager اضافه می‌شوند.
  • Configuration.workerCoroutineContext برای کنترل توزیع کننده که در آن CoroutineWorker اجرا می شود به آن اضافه شد.
  • توسعه دهندگان می توانند NetworkRequest به عنوان یک محدودیت برای یک کارگر از طریق روش Constraints.setRequiredNetworkRequest تعیین کنند. این امکان کنترل دقیق تری بر روی شبکه ای که این کارگر باید اجرا کند را فراهم می کند.
  • WorkManager 2.10.0 اکنون با SDK 35 کامپایل شده است و شامل تغییرات مختلفی برای سازگاری با SDK 35 است.

نسخه 2.10.0-rc01

24 اکتبر 2024

androidx.work:work-*:2.10.0-rc01 منتشر شد. نسخه 2.10.0-rc01 حاوی این commit ها است.

نسخه 2.10.0-beta01

2 اکتبر 2024

androidx.work:work-*:2.10.0-beta01 منتشر شد. نسخه 2.10.0-beta01 حاوی این تعهدات است.

نسخه 2.10.0-alpha04

18 سپتامبر 2024

androidx.work:work-*:2.10.0-alpha04 منتشر شد. نسخه 2.10.0-alpha04 حاوی این commit ها است.

تغییرات API

  • دلیل توقف STOP_REASON_FOREGROUND_SERVICE_TIMEOUT را برای زمانی که یک کارگر پیش‌زمینه به دلیل وقفه زمانی اجرا متوقف می‌شود، بر اساس نوع سرویس پیش‌زمینه اضافه کنید. ( Ibd0af )

نسخه 2.10.0-alpha03

4 سپتامبر 2024

androidx.work:work-*:2.10.0-alpha03 منتشر شد. نسخه 2.10.0-alpha03 حاوی این commit ها است.

ویژگی های جدید

  • برچسب‌های ردیابی از WorkManager به Jobs اضافه شده است که درک «adb shell dumpsys jobscheduler» را بسیار ساده‌تر می‌کند، زیرا حاوی نام Worker در حال اجرا است. بخش‌های Trace نیز در اطراف بخش‌های کلیدی WorkManager اضافه می‌شوند.

تغییرات API

  • WorkManager 2.10.0 اکنون با SDK 35 کامپایل شده است.
  • زمانی که WorkManager stopSelf() فراخوانی نمی‌کند، کارگران پیش‌زمینه از نوع «سرویس کوتاه» و «همگام‌سازی داده» به پایان می‌رسند و باعث ایجاد ANR می‌شوند. این اصلاح فقط برای دستگاه‌های دارای API 34 و 35 اعمال می‌شود که در آن‌ها انواع خدمات پیش‌زمینه معرفی شده‌اند. ( ca06b2 , b/364508145 )
  • API های WorkerParameters جدید که امکان تغییر فرآیند راه دوری را که Worker هنگام استفاده از WorkerFactory به آن متصل می شود، می دهد. ( Ibdc8a ، Ie8a90 ، I7373f )

رفع اشکال

  • خرابی ناشی از تلاش WorkManager برای راه‌اندازی مجدد یک کارگر طولانی‌مدت (یعنی کارگر پیش‌زمینه) را برطرف کنید، زمانی که نوع پیش‌زمینه کار دارای مجوزهای پیش‌نیاز Android 14 بود که لغو شده بودند. ( b/333957914 )
  • طرح دستی دسترسی به APIهای پلتفرم جدید حذف شد زیرا این به طور خودکار از طریق مدلسازی API هنگام استفاده از R8 با AGP 7.3 یا جدیدتر (مثلا R8 نسخه 3.3) و برای همه ساخت‌ها هنگام استفاده از AGP 8.1 یا بالاتر (به عنوان مثال D8 نسخه 8.1) اتفاق می‌افتد. به مشتریانی که از AGP استفاده نمی‌کنند، توصیه می‌شود به نسخه 8.1 یا بالاتر D8 به‌روزرسانی کنند. برای جزئیات بیشتر به این مقاله مراجعه کنید. ( Ia60e0 , b/345472586 )

نسخه 2.10.0-alpha02

17 آوریل 2024

androidx.work:work-*:2.10.0-alpha02 منتشر شد. نسخه 2.10.0-alpha02 حاوی این commit ها است.

تغییرات API

  • قابلیت انتشار بازه های ردیابی از طریق یک @RestrictTo Tracer قابل تنظیم در WorkManager اضافه شده است. ( I17d7f , b/260214125 )
  • Configuration.workerCoroutineContext برای کنترل توزیع کننده که در آن CoroutineWorker اجرا می شود به آن اضافه شد. این کمک می کند تا به طور کامل از استفاده از Dispatchers.Default در WorkManager اجتناب شود. ( Icd1b7 )
  • اضافه کردن کنترل‌کننده‌های استثنای سفارشی برای Workers ( Ib1b74 , b/261190695 )
  • OneTimeWorkRequest.Builder و PeriodicWorkRequest.Builder اکنون می توانند با KClass به جای Class ساخته شوند: val request = OneTimeWorkRequest.Builder(Worker::class).setConstraints(...).build() ( Ib55f6 )
  • کلاس WorkManager به کاتلین منتقل شد. اکنون روش‌هایی که LiveData ، ListenableFuture یا Flow را برمی‌گردانند، اطلاعات پوچ‌پذیری صحیحی را ارائه می‌کنند. اگر مفروضات پوچ بودن در آن کد نادرست بود، ممکن است نیاز به تغییر در کد منبع مشتری داشته باشد. ( If6757 )

نسخه 2.10.0-alpha01

24 ژانویه 2024

androidx.work:work-*:2.10.0-alpha01 منتشر شد. نسخه 2.10.0-alpha01 حاوی این commit ها است.

ویژگی های جدید

  • توسعه دهندگان می توانند NetworkRequest به عنوان یک محدودیت برای یک کارگر از طریق روش Constraints.setRequiredNetworkRequest تعیین کنند. این امکان کنترل دقیق تری بر روی شبکه ای که این کارگر باید اجرا کند را فراهم می کند.

تغییرات API

  • افزودن قابلیتی برای تعیین NetworkRequest به عنوان محدودیت. ( Id98a1 , b/280634452 )

نسخه 2.9

نسخه 2.9.1

7 آگوست 2024

androidx.work:work-*:2.9.1 منتشر شد. نسخه 2.9.1 شامل این commit ها است.

رفع اشکال

  • خرابی ناشی از تلاش WorkManager برای راه‌اندازی مجدد یک کارگر طولانی‌مدت (یعنی کارگر پیش‌زمینه) را برطرف کنید، زمانی که نوع پیش‌زمینه کار دارای مجوزهای پیش‌نیاز Android 14 بود که لغو شده بودند. ( b/333957914 )

نسخه 2.9.0

29 نوامبر 2023

androidx.work:work-*:2.9.0 منتشر شد. نسخه 2.9.0 حاوی این commit ها است.

تغییرات مهم از 2.8.0

  • قابلیت مشاهده از طریق Flow -s. به جای LiveData ، پیشرفت Worker اکنون از طریق Flow از طریق WorkManager.getWorkInfosFlow و روش‌های مشابه قابل مشاهده است.
  • اکنون WorkManager راهنمایی می کند که چرا یک کارگر قبلا متوقف شده است. از طریق متد getStopReason() یا از WorkInfo از طریق getStopReason() می توان آن را از خود کارگر جویا شد.
  • زمان‌بندی دقیق کارگران دوره‌ای از طریق setNextScheduleTimeOverride . این امکان محاسبه پویا برنامه کاری دوره‌ای بعدی را فراهم می‌کند، که می‌تواند برای پیاده‌سازی ویژگی‌های پیشرفته مانند زمان‌های تازه‌سازی تطبیقی، رفتار امتحان مجدد سفارشی، یا ایجاد یک کارمند اخبار فید قبل از بیدار شدن کاربر هر روز صبح بدون جابجایی مورد استفاده قرار گیرد. ExistingPeriodicWorkPolicy.UPDATE باید با این تکنیک‌ها استفاده شود تا از لغو یک کارگر فعلی در حین برنامه‌ریزی بعدی جلوگیری شود.
  • تست WorkManager با تولید تطبیق رشته. ExecutorsMode.PRESERVE_EXECUTORS می توان در initializeTestWorkManager برای حفظ مجری های تنظیم شده در Configuration و استفاده از رشته اصلی واقعی استفاده کرد.
  • API های Coroutines مانند CoroutineWorker از artifact اضافی work-runtime-ktx به artifact work-runtime اصلی منتقل شده اند. work-runtime-ktx اکنون خالی است.

تغییرات API

  • stopReason به WorkInfo اضافه شد. پس از اجرا شدن کارگر، stopReason در دسترس قرار می دهد. این می تواند در گزارش stopReason به روشی قابل استفاده مفید باشد، زیرا هنگامی که یک کارگر متوقف شود، خود یک برنامه می تواند خیلی سریع از بین برود. ( I21386 )
  • اجازه دهید Clock از طریق پیکربندی تنظیم شود و برای اجرای توالی اجرای تست‌های Worker استفاده شود. ( IC586e )
  • متد getStopReason() به ListenableWorker اضافه شد که به دلیل توقف کارگر اشاره می کند. ( I07060 )
  • اضافه شد WorkManagerTestInitHelper#closeWorkDatabase() برای جلوگیری از هشدار Closeguard در مورد منابع لو رفته. ( Ia8d49 )
  • سازنده WorkInfo اکنون عمومی است، که می تواند در آزمایش مفید باشد. ( Ia00b6 , b/209145335 )
  • work-runtime-ktx اکنون خالی است، CoroutineWorker و سایر ابزارهای خاص Kotlin اکنون در آرتیفکت اصلی کار در زمان اجرا در دسترس هستند. ( I71a9a )
  • روش setNextScheduleTimeOverride اضافه شد که امکان تنظیم دقیق برنامه های کاری دوره ای را فراهم می کند ( I3b4da )
  • getNextScheduleTimeMillis برای دریافت اطلاعات زمان اجرای برنامه‌ریزی‌شده به WorkInfo اضافه شد. ( I797e4 )
  • تاخیر اولیه و اطلاعات دوره ای به WorkInfo اضافه می شود. ( I52f2f )
  • روش اضافه شده مشاهده کارگران از طریق جریان از طریق متدهای getWorkInfosByTagFlow ، getWorkInfoByIdFlow ، getWorkInfosForUniqueWorkFlow ، getWorkInfosFlow ( If122a )
  • توضیحات گم شده @RequiresApi(...) به سازنده ها و ویژگی های Constraints اضافه شد. آنها اکنون با حاشیه‌نویسی‌های مربوطه در تنظیم‌کننده‌ها در Constraints.Builder که از نسخه‌های اولیه WorkManager وجود داشت، تراز شده‌اند. ( I6d7d2 )
  • WorkManager اکنون محدودیت جداگانه‌ای برای کارگران محتوای uri دارد تا به آنها اسلات تضمینی در JobScheduler بدهد تا از به‌روزرسانی‌های محتوای مفقود تحت بار زیاد جلوگیری کند. محدودیت را می توان از طریق Configuration.Builder.setContentUriTriggerWorkersLimit پیکربندی کرد. ( IC128f )
  • محدودیت ها به WorkInfo اضافه می شوند. ( I162c0 )

نسخه 2.9.0-rc01

18 اکتبر 2023

androidx.work:work-*:2.9.0-rc01 منتشر شد. نسخه 2.9.0-rc01 حاوی این commit ها است.

  • هیچ تغییری از آخرین نسخه بتا وجود ندارد

نسخه 2.9.0-beta01

6 سپتامبر 2023

androidx.work:work-*:2.9.0-beta01 منتشر شد. نسخه 2.9.0-beta01 حاوی این تعهدات است.

تغییرات API

نسخه 2.9.0-alpha02

26 جولای 2023

androidx.work:work-*:2.9.0-alpha02 منتشر شد. نسخه 2.9.0-alpha02 حاوی این commit ها است.

ویژگی های جدید

  • اکنون WorkManager راهنمایی می کند که چرا یک کارگر قبلا متوقف شده است. از طریق متد getStopReason() یا از WorkInfo از طریق getStopReason() می توان آن را از خود کارگر جویا شد.

تغییرات API

  • stopReason به WorkInfo اضافه شد. پس از اجرای کارگر، stopReason در دسترس قرار می دهد. این می تواند در گزارش stopReason به روشی قابل استفاده مفید باشد، زیرا هنگامی که یک کارگر متوقف شود، خود یک برنامه می تواند خیلی سریع از بین برود. ( I21386 )
  • اجازه دهید ساعت از طریق پیکربندی تنظیم شود و برای اجرای توالی اجرای تست‌های Worker استفاده شود. ( IC586e )
  • متد getStopReason() به ListenableWorker اضافه شد که به دلیل توقف کارگر اشاره می کند. ( I07060 )
  • اضافه شد WorkManagerTestInitHelper#closeWorkDatabase() برای جلوگیری از هشدار Closeguard در مورد منابع لو رفته. ( Ia8d49 )

رفع اشکال

  • اضافه شدن قابلیت دور زدن overrideNextScheduleTime با استفاده از TestDriver و رفع مشکلات تست‌پذیری. ( IC2905 )

نسخه 2.9.0-alpha01

7 ژوئن 2023

androidx.work:work-*:2.9.0-alpha01 منتشر شد. نسخه 2.9.0-alpha01 حاوی این commit ها است.

ویژگی های جدید

  • قابلیت مشاهده از طریق Flow -s. به جای LiveData ، پیشرفت Worker اکنون از طریق Flow از طریق WorkManager.getWorkInfosFlow و روش‌های مشابه قابل مشاهده است.
  • زمان‌بندی دقیق کارگران دوره‌ای از طریق setNextScheduleTimeOverride . این امکان محاسبه پویا برنامه کاری دوره‌ای بعدی را فراهم می‌کند، که می‌تواند برای پیاده‌سازی ویژگی‌های پیشرفته مانند زمان‌های تازه‌سازی تطبیقی، رفتار امتحان مجدد سفارشی، یا ایجاد یک کارمند اخبار فید قبل از بیدار شدن کاربر هر روز صبح بدون جابجایی مورد استفاده قرار گیرد. ExistingPeriodicWorkPolicy.UPDATE باید با این تکنیک‌ها استفاده شود تا از لغو یک کارگر فعلی در حین برنامه‌ریزی بعدی جلوگیری شود.
  • تست WorkManager با تولید تطبیق رشته. ExecutorsMode.PRESERVE_EXECUTORS می توان برای حفظ مجری های تنظیم شده در Configuration و استفاده از رشته اصلی واقعی استفاده کرد.
  • API های Coroutines مانند CoroutineWorker از artifact اضافی work-runtime-ktx به artifact work-runtime اصلی منتقل شده اند. work-runtime-ktx اکنون خالی است.

تغییرات API

  • سازنده WorkInfo اکنون عمومی است، که می تواند در آزمایش مفید باشد. ( Ia00b6 , b/209145335 )
  • work-runtime-ktx اکنون خالی است، CoroutineWorker و سایر ابزارهای خاص kotlin اکنون در آرتیفکت اصلی work-runtime در دسترس هستند. ( I71a9a )
  • روش setNextScheduleTimeOverride اضافه شد که امکان تنظیم دقیق برنامه های کاری دوره ای را فراهم می کند ( I3b4da )
  • نام getEarliestRunTimeMillis به getNextScheduleTimeMillis تغییر یافت. ( I2bd7a )
  • اطلاعات زمان اجرای برنامه ریزی شده بعدی به WorkInfo اضافه می شود. ( I797e4 )
  • تاخیر اولیه و اطلاعات دوره ای به WorkInfo اضافه می شود. ( I52f2f )
  • روش اضافه شده مشاهده کارگران از طریق جریان از طریق متدهای getWorkInfosByTagFlow ، getWorkInfoByIdFlow ، getWorkInfosForUniqueWorkFlow ، getWorkInfosFlow ( If122a )
  • حاشیه نویسی @RequiresApi(...) گم شده به سازنده ها و ویژگی های Constraints اضافه شد. آنها اکنون با حاشیه‌نویسی‌های مربوطه در تنظیم‌کننده‌ها در Constraints.Builder که از نسخه‌های اولیه WorkManager وجود داشت، تراز شده‌اند. ( I6d7d2 )
  • WorkManager اکنون محدودیت جداگانه‌ای برای کارگران محتوای uri دارد تا به آنها اسلات تضمینی در JobScheduler بدهد تا از به‌روزرسانی‌های محتوای مفقود تحت بار زیاد جلوگیری کند. Limit را می توان از طریق Configuration.Builder.setContentUriTriggerWorkersLimit پیکربندی کرد. ( IC128f )
  • محدودیت ها به WorkInfo اضافه می شوند. ( I162c0 )

نسخه 2.8

نسخه 2.8.1

22 مارس 2023

androidx.work:work-*:2.8.1 منتشر شد. نسخه 2.8.1 حاوی این commit ها است.

رفع اشکال

  • ANR در RescheduleReceiver که قبلاً دو پخش همزمان را به درستی مدیریت نمی کرد، رفع شد. ( b/236906724 )

نسخه 2.8.0

8 فوریه 2023

androidx.work:work-*:2.8.0 منتشر شد. نسخه 2.8.0 حاوی این commit ها است.

تغییرات مهم از 2.7.0

ویژگی های جدید

تغییرات API

  • WorkManager.updateWork برای به‌روزرسانی کار با حفظ زمان صف اولیه و زنجیره‌بندی آن اضافه شد. ( I9a248 , b/219446409 )
  • ExistingPeriodicWorkPolicy.UPDATE اضافه شد. این خط‌مشی به‌روزرسانی یک اثر دوره‌ای را با نام اجازه می‌دهد. شبیه REPLACE موجود است، اما کمتر مزاحم است: اگر در حال حاضر در حال اجرا باشد، کارگری را لغو نمی‌کند و زمان صف را حفظ می‌کند - تاخیر و دوره اولیه به جای زمان به‌روزرسانی، از زمان صف اولیه محاسبه می‌شود. 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 ایجاد کرد که برای کاربران Kotlin راحت است. ( IDc390 , b/137568653 )
  • قابلیت بررسی اینکه آیا WorkManager مقداردهی اولیه شده است یا خیر اضافه شده است. همچنین، یک API getConfiguration() برای توسعه دهندگان کتابخانه اضافه کرد تا پیکربندی را که WorkManager با آن مقداردهی اولیه شده بود، دریافت کند. ( I6eff3 , b/212300336 )

رفع اشکال

  • مشکلی در زمان‌بندی حریص که مانع از دویدن کارگران در هنگام بارگیری می‌شد، برطرف شد. ( I9686b , b/248111307 )
  • @RequiresPermission به APIهایی که نیاز به اعطای مجوز POST_NOTIFICATIONS در SDK 33 و بالاتر دارند اضافه شد. ( Ie542e , b/238790278 )
  • هنگام استفاده از suspendCancellableCoroutine لغوها را در CoroutineScope به ListenableFuture منتشر کنید.

نسخه 2.8.0-rc01

7 دسامبر 2022

androidx.work:work-*:2.8.0-rc01 منتشر شد. نسخه 2.8.0-rc01 حاوی این commit ها است.

ویژگی های جدید

  • هیچ ویژگی جدیدی در این نسخه وجود ندارد. این عمدتا یک دست انداز نسخه است

نسخه 2.8.0-beta02

9 نوامبر 2022

androidx.work:work-*:2.8.0-beta02 منتشر شد. نسخه 2.8.0-beta02 حاوی این تعهدات است.

رفع اشکال

  • روش equals ثابت در WorkInfo ، که قبلاً اطلاعات نسل جدید را در نظر نمی گرفت. ( 4977cc )

نسخه 2.8.0-beta01

5 اکتبر 2022

androidx.work:work-*:2.8.0-beta01 منتشر شد. نسخه 2.8.0-beta01 حاوی این تعهدات است.

رفع اشکال

  • مشکلی در زمان‌بندی حریص که مانع از دویدن کارگران در هنگام بارگیری می‌شد، برطرف شد. ( I9686b , b/248111307 )

نسخه 2.8.0-alpha04

7 سپتامبر 2022

androidx.work:work-*:2.8.0-alpha04 منتشر شد. نسخه 2.8.0-alpha04 حاوی این commit ها است.

تغییرات API

  • WorkerInfo.getGeneration() و WorkerParameters.getGeneration() اضافه شدند که نسل یک worker را برمی گرداند. یک کارگر دارای چندین نسل است، اگر از طریق WorkManager.updateWork یا WorkManager.enqueueUniquePeriodicWork با استفاده از ExistingPeriodicWorkPolicy.UPDATE به روز شده باشد. توجه داشته باشید که اگر کارگر در حال حاضر در حال اجرا است، این روش ممکن است نسل جدیدتری را از کارگر فعلی در حال اجرا برگرداند، اگر به روز رسانی در حین اجرای کارگر رخ داده باشد. ( I665c5 , b/219446409 ) ( I128a9 , b/219446409 )
  • InitializationExceptionHandler اضافه شد، یک Exception Handler که می تواند برای تعیین اینکه آیا هنگام تلاش برای مقداردهی اولیه WorkManager مشکلی وجود دارد یا خیر استفاده شود. ( I061de )

نسخه 2.8.0-alpha03

10 آگوست 2022

androidx.work:work-*:2.8.0-alpha03 منتشر شد. نسخه 2.8.0-alpha03 حاوی این commit ها است.

ویژگی های جدید

  • توانایی به‌روزرسانی WorkRequests به روشی غیر سرزده اضافه شد، با حفظ زمان صف اولیه، زنجیره‌بندی و غیره. برای جزئیات بیشتر به WorkManager.updateWork و ExistingPeriodicWorkPolicy.UPDATE مراجعه کنید.

تغییرات API

  • WorkManager.updateWork برای به‌روزرسانی کار با حفظ زمان صف اولیه و زنجیره‌بندی آن اضافه شد. ( I9a248 , b/219446409 )
  • ExistingPeriodicWorkPolicy.UPDATE اضافه شد. این خط مشی اجازه می دهد تا یک اثر دوره ای را با نام به روز کنید. شبیه REPLACE موجود است، اما کمتر مزاحم است: اگر در حال حاضر در حال اجرا باشد، کارگری را لغو نمی‌کند و زمان صف را حفظ می‌کند - تاخیر و دوره اولیه به جای زمان به‌روزرسانی، از زمان صف اولیه محاسبه می‌شود. 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 )

نسخه 2.8.0-alpha02

6 آوریل 2022

androidx.work:work-*:2.8.0-alpha02 منتشر شد. نسخه 2.8.0-alpha02 حاوی این commit ها است.

تغییرات API

  • اکنون می توان به جای استفاده از Builder که برای کاربران Kotlin راحت است، محدودیت ها را مستقیماً ایجاد کرد. ( IDc390 , b/137568653 )
  • قابلیت بررسی اینکه آیا WorkManager مقداردهی اولیه شده است یا خیر اضافه شده است. همچنین، یک API getConfiguration() برای توسعه دهندگان کتابخانه اضافه کرد تا پیکربندی را که WorkManager با آن مقداردهی اولیه شده بود، دریافت کند. ( I6eff3 , b/212300336 )

نسخه 2.8.0-alpha01

12 ژانویه 2022

androidx.work:work-*:2.8.0-alpha01 منتشر شد. نسخه 2.8.0-alpha01 حاوی این commit ها است.

تغییرات 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 اکنون setForeground بازگشتی Completable دارد که می تواند به جای setForegroundInfoAsync که ListenableFuture برمی گرداند استفاده شود. ( I992a3 , b/203851459 )

رفع اشکال

  • هنگام استفاده از suspendCancellableCoroutine لغوها را در CoroutineScope به ListenableFuture منتشر کنید. ( I77e63 )

نسخه 2.7

نسخه 2.7.1

17 نوامبر 2021

androidx.work:work-*:2.7.1 منتشر شد. نسخه 2.7.1 حاوی این commit ها است.

رفع اشکال

  • هنگام استفاده از suspendCancellableCoroutine لغوها در CoroutineScope به ListenableFuture منتشر می شوند. ( I77e63 )
  • زمانی که درخواست‌های کاری با تأخیر به‌عنوان تسریع‌شده علامت‌گذاری می‌شوند، فوراً استثنا ایجاد می‌شود. bef1762

نسخه 2.7.0

13 اکتبر 2021

androidx.work:work-*:2.7.0 منتشر شد. نسخه 2.7.0 حاوی این commit ها است.

تغییرات مهم از 2.6.0

  • WorkManager یک API WorkRequest.Builder.setExpedited(...) جدید را برای کمک به محدودیت های خدمات پیش زمینه در اندروید 12 معرفی می کند.

  • هنگام استفاده از setExpedited(...) ، WorkManager به کارهای تسریع شده در JobScheduler با شروع Android 12 واگذار می کند، در حالی که با واگذاری به یک سرویس پیش زمینه، سازگاری با نسخه های قبلی اندروید را فراهم می کند.

نسخه 2.7.0-rc01

29 سپتامبر 2021

androidx.work:work-*:2.7.0-rc01 منتشر شد. نسخه 2.7.0-rc01 حاوی این commit ها است.

این نسخه مشابه androidx.work:work-*:2.7.0-beta01 است.

نسخه 2.7.0-beta01

1 سپتامبر 2021

androidx.work:work-*:2.7.0-beta01 منتشر شد. نسخه 2.7.0-beta01 حاوی این تعهدات است.

ویژگی های جدید

  • هنگام راه اندازی WorkManager، اختلاف چند فرآیندی SQLite را کاهش دهید.

تغییرات API

  • APIهای @ExperimentalExpeditedWork را حذف کنید، با توجه به اینکه APIهای پلتفرم زیرین برای Android 12 (S) پایدار هستند. ( aosp/1792806 )

رفع اشکال

  • برای کارگران تسریع شده که getForegroundInfoAsync() را پیاده سازی نمی کنند، پیام خطای بهتری ارائه دهید. ( aosp/1809376 )

نسخه 2.7.0-alpha05

21 جولای 2021

androidx.work:work-*:2.7.0-alpha05 منتشر شد. نسخه 2.7.0-alpha05 حاوی این commit ها است.

این نسخه همچنین حاوی رفع اشکال از نسخه WorkManager 2.6.0-beta02 است.

نسخه 2.7.0-alpha04

2 ژوئن 2021

androidx.work:work-*:2.7.0-alpha04 منتشر شد.

این نسخه همچنین شامل تغییرات نسخه 2.6.0-beta01 است.

تغییرات API

  • ListenableWorker.setForegroundAsync() دیگر منسوخ نشده است.
  • توصیه می کنیم در صورت امکان از WorkRequest.Builder.setExpedited(...) API استفاده کنید. برای پشتیبانی بهتر از موقعیت‌هایی که برنامه تحت محدودیت‌های سرویس پیش‌زمینه نیست ، توسعه‌دهندگان می‌توانند از API ListenableWorker.setForegroundAsync() استفاده کنند.
  • اگر ListenableWorker.setForegroundAsync() فراخوانی شود، زمانی که برنامه در معرض محدودیت‌های سرویس پیش‌زمینه باشد، ForegroundServiceStartNotAllowedException را پرتاب می‌کند.

رفع اشکال

  • وقتی کارهای تسریع شده دوباره برنامه ریزی می شوند، دیگر تسریع نمی شوند. تبدیل به مشاغل معمولی می شوند.

نسخه 2.7.0-alpha03

21 آوریل 2021

androidx.work:work-*:2.7.0-alpha03 منتشر شد. نسخه 2.7.0-alpha03 حاوی این commit ها است.

ویژگی های جدید

  • From WorkManager 2.6.0-alpha02 : پشتیبانی از Workers را اضافه می کند که می توانند در هر فرآیندی اجرا شوند. ( 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 )

نسخه 2.7.0-alpha02

10 مارس 2021

androidx.work:work-*:2.7.0-alpha02 منتشر شد. نسخه 2.7.0-alpha02 حاوی این commit ها است.

رفع اشکال

  • تغییرپذیری PendingIntent را آشکار کنید تا هنگام هدف قرار دادن Android 12 خرابی را برطرف کنید. ( b/180884673 )

نسخه 2.7.0-alpha01

18 فوریه 2021

androidx.work:work-*:2.7.0-alpha01 منتشر شد. نسخه 2.7.0-alpha01 حاوی این commit ها است.

ویژگی های جدید

  • WorkManager یک API WorkRequest.Builder.setExpedited(...) جدید را برای در نظر گرفتن محدودیت های خدمات پیش زمینه در اندروید 12 معرفی می کند.

    وقتی برنامه‌ها در پس‌زمینه هستند، دیگر نمی‌توانند سرویس پیش‌زمینه را راه‌اندازی کنند. بنابراین، برای پشتیبانی بهتر از کارهای طولانی مدتی که قبلاً به چرخه عمر یک سرویس پیش‌زمینه وابسته بود، برنامه‌ها می‌توانند WorkRequest را به‌عنوان تسریع شده علامت‌گذاری کنند.

    این API جایگزینی برای APIهای setForegroundAsync(...) / setForeground(...) است که اکنون منسوخ شده اند.

    هنگام استفاده از setExpedited(...) ، WorkManager به کارهای تسریع شده در JobScheduler با شروع Android 12 واگذار می‌کند، در حالی که با واگذاری به خدمات پیش‌زمینه، سازگاری با نسخه‌های قبلی اندروید را فراهم می‌کند.

تغییرات API

  • اضافه کردن پشتیبانی برای WorkRequest های سریع.

نسخه 2.6.0

نسخه 2.6.0

1 سپتامبر 2021

androidx.work:work-*:2.6.0 منتشر شد. نسخه 2.6.0 حاوی این commit ها است.

تغییرات مهم از 2.5.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" />
    
  • پشتیبانی اضافه شده برای Workers که می تواند در هر فرآیندی اجرا شود. ( Iaf200 )

  • یک RemoteCoroutineWorker اضافه شد که اجرای RemoteListenableWorker است که می تواند به یک فرآیند راه دور متصل شود. ( I30578 )

نسخه 2.6.0-rc01

4 آگوست 2021

androidx.work:work-*:2.6.0-rc01 منتشر شد. نسخه 2.6.0-rc01 حاوی این commit ها است.

این نسخه مشابه androidx.work:work-*:2.6.0-beta02 است.

نسخه 2.6.0-beta02

21 جولای 2021

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

نسخه 2.6.0-beta01

2 ژوئن 2021

androidx.work:work-*:2.6.0-beta01 منتشر شد. نسخه 2.6.0-beta01 حاوی این تعهدات است.

این نسخه حاوی برخی بهبودهای جزئی در اسناد است. نسخه تا حد زیادی مشابه 2.6.0-alpha02 است.

نسخه 2.6.0-alpha02

21 آوریل 2021

androidx.work:work-*:2.6.0-alpha02 منتشر شد. نسخه 2.6.0-alpha02 حاوی این commit ها است.

ویژگی های جدید

  • پشتیبانی برای Workers اضافه می کند که می تواند در هر فرآیندی اجرا شود. ( Iaf200 )

  • یک RemoteCoroutineWorker اضافه شد که اجرای RemoteListenableWorker است که می تواند به یک فرآیند راه دور متصل شود. ( I30578 )

تغییرات API

  • پشتیبانی از محدودیت شبکه TEMPORARILY_UNMETERED اضافه شد. ( I08d5e )
  • پشتیبانی کارگر چند فرآیندی برای setProgressAsync() . ( Ib6d08 )
  • WorkManagerInitializer عمومی کنید تا سایر androidx.startup.Initializer بتوانند از اینها به عنوان وابستگی استفاده کنند. ( I5ab11 )

نسخه 2.6.0-alpha01

24 مارس 2021

androidx.work:work-*:2.6.0-alpha01 منتشر شد. نسخه 2.6.0-alpha01 حاوی این commit ها است.

ویژگی های جدید

  • 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 اضافه کنید که باعث می شود هنگام استفاده از AlarmManager API یک SecurityException ایجاد شود. ( aosp/1587518 )

نسخه 2.5.0

نسخه 2.5.0

27 ژانویه 2021

androidx.work:work-*:2.5.0 منتشر شد. نسخه 2.5.0 شامل این commit ها است.

تغییرات عمده از 2.4.0

  • یک مصنوع جدید :work:work-multiprocess برای برنامه هایی که از چندین فرآیند استفاده می کنند. این کار با یکسان کردن زمان‌بندی درخواست کار در یک فرآیند واحد، دستاوردهای عملکردی را معرفی می‌کند.
    • برای استفاده از work-multiprocess ، یک وابستگی به: implementation "androidx.work:work-multiprocess:2.5.0" تعریف کنید.
    • یک فرآیند اولیه را با استفاده از Configuration.Builder.setDefaultProcessName(String) تعیین کنید.
    • هنگام استفاده از work-multiprocess شما همچنین می خواهید از RemoteWorkManager برای مدیریت WorkRequest خود استفاده کنید. RemoteWorkManager همیشه به فرآیند تعیین شده دسترسی پیدا می کند. زمانبندی در فرآیند نیز در فرآیند تعیین شده اجرا می شود.
  • گاهی اوقات، ActivityManager نمی تواند نمونه JobService را برای شروع یک کار نمونه سازی کند. این باعث می شود که کار اصلی به دلیل یک اشکال پلتفرم بی سر و صدا حذف شود. WorkManager اکنون تضمین می کند که برای هر WorkRequest زمانی که یک Application با تطبیق کارها مقداردهی اولیه می شود، کارهای پشتیبان وجود دارد. این امر قابلیت اطمینان اجرای کار را تا حد زیادی بهبود می بخشد. ( b/172475041 , aosp/1489577 )
  • WorkManager رشد پایگاه داده را با کاهش مدت زمان بافری که WorkRequest ها پس از تکمیل WorkRequest ردیابی می کنند، محدود می کند. مدت زمان قبل 7 روز بود. به 1 روز کاهش یافته است + مدت نگهداری نتایج برای حداقل . ( aosp/1419708 )
  • The TestListenableWorkerBuilder now supports the reified class extending ListenableWorker to make testing easier. ( aosp/1443299 , b/169787349 )
  • WorkManager inspector is now available when using Android Studio Arctic Fox.

Version 2.5.0-rc01

13 ژانویه 2021

androidx.work:work-*:2.5.0-rc01 is released. Version 2.5.0-rc01 contains these commits.

رفع اشکال

  • Fixed a bug where getWorkInfosLiveData was not correctly getting invalidated after entities were updated when using the WorkQuery based 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 NoSuchElementException s when trying to unbind from a dead process. ( aosp/1530589 )
  • Improve ConstraintTrackingWorker to only stop a ListenableWorker if it's not already been stopped. ( aosp/1496844 , b/172946965 )
  • Update androidx.work libraries to target Java 8 ( Ibd2f2 )

Version 2.5.0-beta02

2 دسامبر 2020

androidx.work:work-*:2.5.0-beta02 is released. Version 2.5.0-beta02 contains these commits.

رفع اشکال

  • Fixed a bug in androidx.work:work-multiprocess where WorkManager inadvertently blocked the calling thread when trying to bind to the designated process. ( aosp/1475538 )
  • Fixed a bug where PeriodicWorkRequest s 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

28 اکتبر 2020

androidx.work:work-*:2.5.0-beta01 is released. Version 2.5.0-beta01 contains these commits.

ویژگی های جدید

  • WorkManager automatically throttles the number of WorkRequest s that can be picked up by the in-process scheduler. The requests are still executed in FIFO order. ( aosp/1455228 )
  • WorkManager attempts to recover when the application's datastore is in a bad state. ( aosp/1463103 )

رفع اشکال

  • When ListenableWorker s are interrupted, mark them ENQUEUED immediately so they can be subsequently rescheduled. ( aosp/1455618 , b/170273988 )

Version 2.5.0-alpha03

14 اکتبر 2020

androidx.work:work-*:2.5.0-alpha03 is released. Version 2.5.0-alpha03 contains these commits.

تغییرات API

  • TestListenableWorkerBuilder and TestWorkerBuilder do not use raw types. ( I883ad , b/169787349 )

رفع اشکال

  • Use ApplicationInfo to determine the name of the default app process. ( b/168716641 , aosp/1429950 )
  • Fix the visibility rules for RemoteWorkManager and RemoteWorkContinuation . 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

16 سپتامبر 2020

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 id s to query WorkInfo s. ( 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) . The processName is a fully qualified process name which looks like packageName:processName (eg com.example:remote ).
    • A set of new APIs: RemoteWorkManager and RemoteWorkContinuation to enqueue , cancel and query work requests. These APIs do not include LiveData variants to avoid SQLite contention across multiple-processes. All calls to enqueue , cancel and query are forwarded to a primary app process using AIDL and return a fluent ListenableFuture . ( aosp/1392657 , aosp/1411210 , aosp/1412215 , aosp/1417713 )

تغییرات API

  • WorkManager now prunes completed WorkRequest s that have no incomplete dependencies more aggressively. The buffer duration changed from 7 days to 1 day. ( aosp/1419708 )

رفع اشکال

  • WorkManager now reconciles jobs proactively so WorkRequest s and JobScheduler jobs are in sync when WorkManager is initialized. ( aosp/1412794 , b/166292069 )

Version 2.5.0-alpha01

19 آگوست 2020

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 WorkManager going forward. Stay tuned for additional updates.

رفع اشکال

  • Handle SecurityException s when tracking network state on some devices. ( aosp/1396969 )

External Contribution

نسخه 2.4.0

نسخه 2.4.0

22 جولای 2020

androidx.work:work-*:2.4.0 is released. Version 2.4.0 contains these commits.

Major changes since 2.3.0

  • WorkManager s 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 tracks WorkRequest s which might be executed in the future, including PeriodicWorkRequests. The in-process Scheduler also does not observe scheduling limits (but is still restricted to the size of the Executor being 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, WorkManager also introduces a new configurable RunnableScheduler . ( 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 WorkInfo s by using a WorkQuery . This is useful when developers want to query WorkInfo s by a combination of multiple attributes. For more information look at WorkQuery.Builder.fromStates(...) , WorkQuery.Builder. fromTags(...) or WorkQuery.Builder.fromUniqueWorkNames(...) . ( aosp/1253230 , b/143847546 )
  • Add 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 )
  • Add ExistingWorkPolicy.APPEND_OR_REPLACE which is similar to APPEND , but replaces a chain that has cancelled or failed prerequisites. ( b/134613984 , aosp/1199640 )

  • Provide the ability to add a custom RunnableScheduler to 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_LOW constraints 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 foregroundServiceType when using setForegroundAsync() 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 ListenableWorker implementations are now public when using the default WorkerFactory . ( aosp/1291262 )
  • Calls to setForegroundAsync() that do not complete before completion of a ListenableWorker will now be signalled via an IllegalStateException on the returned ListenableFuture . ( aosp/1262743 )

  • Fix a bug where the ForegroundService is not stopped after a foreground Worker is interrupted. ( b/155579898 , aosp/1302153 )

  • Fix a bug where WorkManager attempts to execute multiple instances of a Worker bound to a Foreground Service ( b/156310133 , aosp/1309853 )

Version 2.4.0-rc01

24 ژوئن 2020

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

20 مه 2020

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 ForegroundService is not stopped after a foreground Worker is interrupted. ( b/155579898 , aosp/1302153 )
  • Fix a bug where WorkManager attempts to execute multiple instances of a Worker bound 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_LOW constraints more closely with the platform. ( aosp/1312583 )

Version 2.4.0-alpha03

29 آوریل 2020

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 ListenableWorker implementations are now public when using the default WorkerFactory . ( aosp/1291262 )

تغییرات API

  • Calling setProgressAsync() after a ListenableWorker has finished execution will now signal an Exception via the ListenableFuture . ( aosp/1285494 )
  • WorkQuery.Builder is now marked final . ( aosp/1275037 )
  • WorkQuery.Builder factory methods withStates , withTags and withUniqueWorkNames have been renamed to fromStates , fromTags and fromUniqueWorkNames respectively. ( aosp/1280287 )

رفع اشکال

Version 2.4.0-alpha02

1 آوریل 2020

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 WorkRequest s requires both Constraints.setRequiresCharging(...) and Constraints.setRequiresDeviceIdle(...) . Some devices are never charging and idle at the same time. So such requests would run less frequently than expected. ( aosp/1253840 )

تغییرات API

  • Added the ability to query for WorkInfo s by using a WorkQuery . This is useful when developers want to query WorkInfo s by a combination of multiple attributes. For more information look at WorkQuery.Builder withStates(...) , WorkQuery.Builder withTags(...) or WorkQuery.Builder withUniqueWorkNames(...) . ( aosp/1253230 , b/143847546 )

  • Calls to setForegroundAsync() that do not complete before completion of a ListenableWorker will now be signalled via an IllegalStateException on the returned ListenableFuture . ( aosp/1262743 )

رفع اشکال

  • Fixed the lint rule that checks for invalid interval durations for PeriodicWorkRequest s. ( aosp/1254846 , b/152606442 )

Version 2.4.0-alpha01

4 مارس 2020

androidx.work:work-*:2.4.0-alpha01 is released. Version 2.4.0-alpha01 contains these commits.

ویژگی های جدید

  • WorkManager s 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 tracks WorkRequest s which might be executed in the future, including PeriodicWorkRequest s. The in-process Scheduler also does not observe scheduling limits (but is still restricted to the size of the Executor being used by WorkManager). This means that the application can now execute a lot more WorkRequest s 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 foregroundServiceType when using setForegroundAsync() APIs. ( b/147873061 , aosp/1215915 )
    • Specifying JobScheduler ids that WorkManager should use when using JobService APIs directly. ( aosp/1223567 )

تغییرات API

  • Add ExistingWorkPolicy.APPEND_OR_REPLACE which is similar to APPEND , but replaces a chain that has cancelled or failed prerequisites. ( b/134613984 , aosp/1199640 )

  • Provide the ability to add a custom RunnableScheduler to track WorkRequest s that need to be executed in the future. This is used by the in-process Scheduler. ( aosp/1203944 )

رفع اشکال

  • Deprecated setProgress() in RxWorker because it previously returned a Single<Void> which is an impossible type. Added a new API setCompletableProgress() which returns a Completable instead; and added new Lint rules which help migrate to the new APIs. ( b/150080946 , aosp/1242665 )

Version 2.3.4

Version 2.3.4

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 Worker s 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 )

نسخه 2.3.3

نسخه 2.3.3

4 مارس 2020

androidx.work:work-*:2.3.3 is released. Version 2.3.3 contains these commits.

رفع اشکال

  • Fixed a bug where if a Worker was interrupted, it would not get rescheduled correctly. ( b/150325687 , aosp/1246571 )

نسخه 2.3.2

نسخه 2.3.2

19 فوریه 2020

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 )

نسخه 2.3.1

نسخه 2.3.1

5 فوریه 2020

androidx.work:work-*:2.3.1 is released. Version 2.3.1 contains these commits .

رفع اشکال

  • Better manage the lifecycle of Notification s for long running Worker s that run when a foreground Service is active. ( aosp/1218539 , b/147249312 )
  • WorkManager now depends on androidx.sqlite:sqlite-framework:2.1.0 stable. ( aosp/1217729 )
  • Added lint rules to ensure that a foregroundServiceType is specified in the AndroidManifest.xml when using foregroundServiceType s in ForegroundInfo . ( aosp/1214207 , b/147873061 )

نسخه 2.3.0

نسخه 2.3.0

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

8 ژانویه 2020

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-testing artifact now defines an api dependency on work-runtime-ktx . ( aosp/1194410 )

Version 2.3.0-beta02

18 دسامبر 2019

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.WorkManagerInitializer is removed from the AndroidManifest.xml when using on demand initialization. ( aosp/1167007 )
  • Added a lint warning when enqueue() is used for a PeriodicWorkRequest instead of enqueueUniquePeriodicWork() . ( aosp/1166032 )

API تغییر می کند

  • ForegroundInfo now requires you to specify the notificationId to be used when using ListenableWorker.setForegroundAsync() . This is a breaking change. This allows you to run multiple long running Worker s in parallel. WorkManager also better manages lifetimes of the provided Notification s. ( 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 WorkRequest s would cause an incorrect WorkContinuation chain to be built. ( b/142835274 , aosp/1157051 )

Dependency changes

  • WorkManager now uses Room 2.2.2.

Version 2.3.0-beta01

20 نوامبر 2019

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.Provider when using on-demand initialization. aosp/1164559

Version 2.3.0-alpha03

23 اکتبر 2019

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 cancel WorkRequest s without having to register another component in the AndroidManifest.xml . This API makes it especially easy to cancel WorkRequest s from Notification s. We expect this to be paired with the new foreground APIs in 2.3.0.
  • WorkManager now depends on androidx.room:*:2.2.0 stable.

API تغییر می کند

  • Renamed ForegroundInfo.getNotificationType() to ForegroundInfo.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

9 اکتبر 2019

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() (or CoroutineWorker#setForeground() for Kotlin). ( aosp/1133636 )

API تغییر می کند

  • The containsKey API in Data is renamed to hasKeyWithValueOfType . The corresponding extension method in the ktx library has also been renamed. ( b/141916545 )

رفع اشکال

  • WorkManager schedules work fairly when the number of WorkRequest s 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 )
  • Data now has a much more useful toString() representation. ( b/140945323 )
  • Data now has a better equals() method. It also supports deepEquals for Array types. ( b/140922528 )
  • WorkManager now stores its internal database and preference files in a no backup directory. ( b/114808216 )

Version 2.3.0-alpha01

22 آگوست 2019

androidx.work:work-*:2.3.September 5, 20190-alpha01 is released. The commits included in this version can be found here .

ویژگی های جدید

  • ListenableWorker s can now set progress via the setProgressAsync() API. Also added a corresponding suspend -ing setProgress API in CoroutineWorker and a setProgress in RxWorker which returns a Single<Void> . With these new APIs Workers can convey progress information via WorkInfo which has a corresponding getProgress API. ( b/79481554 )
  • Data has a containsKey() API which can be used to validate that input data to Worker s has keys with the expected type. ( b/117136838 )
  • Data can now be serialized using Data.toByteArray() and Data.fromByteArray() . Note that there are no versioning guarantees with Data so 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 InputMergerFactory via Configuration.setInputMergerFactory . ( b/133273159 )

API تغییر می کند

  • WorkManager will throw an instance of IllegalStateException if a WorkerFactory returns an instance of ListenableWorker which has been previously invoked. ( b/139554406 )
  • Documentation updates around ListenableFuture cancellation and the onStopped() callback in ListenableWorker . ( b/138413671 )

رفع اشکال

  • The in-process Scheduler now ignores WorkRequest s with the idle constraint. These requests are now only picked up by JobScheduler when the device is actually idle . ( aosp/1089779 )
  • TestScheduler now correctly uses the specified Executor for its internal task executor in tests. ( aosp/1090749 )

نسخه 2.2.0

نسخه 2.2.0

15 آگوست 2019

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

30 جولای 2019

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 RejectedExecutionException in rare cases. ( aosp/1092374 ) ( b/138238197 ).
  • Added a workaround for a NullPointerException when using JobScheduler APIs on some devices. ( aosp/1091020 ) ( b/138364061 ), ( b/138441699 )

Version 2.2.0-beta02

19 جولای 2019

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

17 جولای 2019

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-beta01 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.

رفع اشکال

  • Fix for IllegalArgumentException when tracking network state on Nvidia Shield K1 tablets. ( aosp/1010188 )

نسخه 2.1.0

نسخه 2.1.0

11 جولای 2019

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-ktx now requires Java 8. If you run into any issues, you can add the following to your build.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:
    1. Disable the automatic initializer .
    2. Implement Configuration.Provider on your custom Application object.
    3. Change all references of WorkManager.getInstance() to WorkManager.getInstance(Context) . As part of this change, we have deprecated WorkManager.getInstance() . It is always safer to call the new WorkManager.getInstance(Context) replacement, even if you're not doing on-demand initialization.
  • PeriodicWorkRequest s now support initial delays. You can use the setInitialDelay method on PeriodicWorkRequest.Builder to set an initial delay. b/111404867
  • Added the ability to delegate to one or more registered WorkerFactory s using DelegatingWorkerFactory . b/131435993
  • Added the ability to customize the Executor used by WorkManager for all its internal book-keeping via Configuration.Builder.setTaskExecutor .
  • Added the ability to create unit testable Worker and ListenableWorker classes by using TestWorkerBuilder and TestListenableWorkerBuilder in the work-testing artifact.
    • Note that work-testing now pulls in Kotlin as a dependency and includes several Kotlin extensions by default.
  • Added run attempt count to WorkInfo . b/127290461
  • Data types can now store and retrieve bytes and byte arrays. This does NOT change the maximum size of Data objects.
  • WorkManager now depends on Room 2.1.0 , which should fix some database issues.

Version 2.1.0-rc01

27 ژوئن 2019

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 JobScheduler while a backup was in progress b/135858602 .

Version 2.1.0-beta02

20 ژوئن 2019

androidx.work:work-*:2.1.0-beta02 is released. The commits included in this version can be found here .

رفع اشکال

  • TestListenableWorkerBuilder now uses the correct WorkerFactory when creating instances of ListenableWorker . b/135275844
  • Fixed a bug which caused drifts in the execution windows for WorkRequest s due to process death. b/135272196

Version 2.1.0-beta01

13 ژوئن 2019

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

5 ژوئن 2019

androidx.work:*:2.1.0-alpha03 is released.

رفع اشکال

  • Improved documentation for PeriodicWorkRequest s.
  • WorkManagerTestInitHelper now 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 JobScheduler when 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

16 مه 2019

WorkManager 2.1.0-alpha02 is released. This version contains several new APIs.

تغییرات API

  • PeriodicWorkRequest s now support initial delays. You can use the setInitialDelay method on PeriodicWorkRequest.Builder to set an initial delay. b/111404867

  • Added the ability to delegate to one or more registered WorkerFactory s using DelegatingWorkerFactory . b/131435993

  • Added the ability to customize the Executor used by WorkManager for all its internal book-keeping via Configuration.Builder.setTaskExecutor .

  • Improved documentation around WorkRequest.keepResultsForAtLeast ( b/130638001 ), on-demand initialization, and PeriodicWorkRequest.Builder ( b/131711394 ).

Version 2.1.0-alpha01

24 آوریل 2019

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

  • Added on-demand initialization for WorkManager, which will create WorkManager only when referenced. b/127497100 To set up your project for on-demand initialization:
    1. Disable the automatic initializer .
    2. Implement Configuration.Provider on your custom Application object.
    3. Change all references of WorkManager.getInstance() to WorkManager.getInstance(Context) . As part of this change, we have deprecated WorkManager.getInstance() . It is always safer to call the new WorkManager.getInstance(Context) replacement, even if you're not doing on-demand initialization.
  • Added the ability to create unit testable Worker and ListenableWorker classes by using TestWorkerBuilder and TestListenableWorkerBuilder in the work-testing artifact.
    • Note that work-testing now pulls in Kotlin as a dependency, but also includes several Kotlin extensions by default.
  • Added run attempt count to WorkInfo . b/127290461
  • Data types can now store and retrieve bytes and byte arrays. This does NOT change the maximum size of Data objects.
  • Deprecated CoroutineWorker.coroutineContext . This field was incorrectly typed as a CoroutineDispatcher ; you should no longer need it as you can go to the desired coroutineContext yourself in the body of the suspending function.
  • RxWorker.createWork() and RxWorker.getBackgroundScheduler() are now annotated with @NonNull return types.

نسخه 2.0.1

نسخه 2.0.1

9 آوریل 2019

WorkManager 2.0.1 is released. This release is identical to 2.0.1-rc01 .

Version 2.0.1-rc01

3 آوریل 2019

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 StackOverflowError dealing with long chains of work. b/129091233
  • Updated documentation for PeriodicWorkRequest s to indicate that flex time is not supported on API 23.
  • Fixed some broken links in the Kotlin documentation.

نسخه 2.0.0

نسخه 2.0.0

20 مارس 2019

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

7 مارس 2019

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

For information on using Kotlin extensions, see the KTX documentation .
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")
}

نسخه 1.0.1

نسخه 1.0.1

9 آوریل 2019

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

2 آوریل 2019

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 StackOverflowError dealing with long chains of work. b/129091233

نسخه 1.0.0

نسخه 1.0.0

05 مارس 2019

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

21 فوریه 2019

This is the second release candidate for WorkManager's 1.0.0 stable release. This release contains two bug fixes.

رفع اشکال

  • Worker s are now correctly scheduled after an application crash. b/124546316

  • Worker s that throw an unchecked Exception are now correctly marked as FAILED and no longer crash the app process.

Version 1.0.0-rc01

14 فوریه 2019

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 flex windows for PeriodicWorkRequests. b/124274584

Version 1.0.0-beta05

6 فوریه 2019

This release contains some bug fixes.

رفع اشکال

  • Fixed a case where JobScheduler.getPendingJob(...) was used on API 23. b/123893059
  • Fixed a NullPointerException on devices running Android 5.1 (API level 22) or lower. b/123835104

Version 1.0.0-beta04

4 فوریه 2019

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

25 ژانویه 2019

This release contains some bug fixes.

رفع اشکال

  • We introduced a regression 1.0.0-beta02 that 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 ConcurrentModificationException on devices running Android 5.1 (API or) or lower. This is a continuation of the fix in 1.0.0-beta02 . b/121345393
  • Added exported=false for 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

15 ژانویه 2019

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 ConcurrentModificationException on 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 LiveData that WorkManager uses.
  • Moved to use Room dependency 1.1.1 instead of 1.1.1-rc01 ; these versions are identical. b/122578011

Version 1.0.0-beta01

19 دسامبر 2018

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

12 دسامبر 2018

This release contains a minor API change that will be helpful for some Kotlin users.

تغییرات API

  • androidx.work.Result has been moved to be an inner class of ListenableWorker . This prevents refactoring conflicts with Kotlin's top-level Result class. This is a breaking API change. b/120564418

Breaking API Changes

  • androidx.work.Result has been moved to be an inner class of ListenableWorker .

Version 1.0.0-alpha12

5 دسامبر 2018

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

  • A new artifact, work-rxjava2 , introduces RxWorker . This is a ListenableWorker that expects a Single<Payload> .
  • Support for Firebase JobDispatcher has been removed because of its impending deprecation. This means that the work-firebase artifact will no longer be updated as we head into beta. We will be looking into adding an alternative in the future.
  • Combined Payload into Result . Result is now a "sealed class" with three concrete implementations, which you can obtain via Result.success() (or Result.success(Data) ), Result.failure() (or Result.failure(Data) ), and Result.retry() . Your ListenableFuture s now result Result instead of Payload . Worker s don't have getter and setter methods for output Data . This is a breaking change.
  • Added Constraints.Builder.setTriggerContentMaxDelay(long, TimeUnit) and Constraints.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() and ListenableFuture.await() Kotlin extension methods.
  • Renamed Operation.getException() to Operation.getThrowable() . This is a breaking change.
  • The ContentUriTriggers class 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 , and OneTimeWorkRequest to streamline the API. To fix any build problems, you can wrap your existing varargs with Arrays.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 existing combine methods 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.
  • LiveData that is observed via observeForever is 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 a WorkInfo with the CANCELLED State during ListenableWorker.onStopped() .
  • Treat null Result s as failures in ListenableWorker . 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-firebase artifact will no longer be updated as we head into beta. We will be looking into adding an alternative in the future.
  • Combined Payload into Result . Result is now a "sealed class" with three concrete implementations, which you can obtain via Result.success() (or Result.success(Data) ), Result.failure() (or Result.failure(Data) ), and Result.retry() . Your ListenableFuture s now result Result instead of Payload . Worker s don't have getter and setter methods for output Data .
  • Added Operation.await() and ListenableFuture.await() Kotlin extension methods.
  • Renamed Operation.getException() to Operation.getThrowable() .
  • The ContentUriTriggers class and methods referencing it are no longer available for public usage.
  • Removed the rest of the varargs methods in WorkManager , WorkContinuation , and OneTimeWorkRequest to streamline the API. To fix any build problems, you can wrap your existing varargs with Arrays.asList(...) . We still include single-argument versions of each method.
  • Removed WorkContinuation.combine(OneTimeWorkRequest, *) variants. They were presenting a confusing API; the existing combine methods are more understandable.

Version 1.0.0-alpha11

8 نوامبر 2018

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

  • work-runtime-ktx introduces a new CoroutineWorker .
  • WorkStatus has been renamed to WorkInfo . All corresponding getStatus method variants have been renamed to the corresponding getWorkInfo variants. This is a breaking change.
  • ListenableWorker.onStopped() no longer accepts has a boolean argument representing if the WorkRequest was cancelled. WorkManager no longer makes this distinction. This is a breaking change.
  • androidx.work.test package has been renamed to androidx.work.testing package. This is a breaking change.
  • Setters on Constraints are no longer a part of the public API. This is a breaking change.
  • WorkerParameters.getTriggeredContentUris() and WorkerParameters.getTriggeredContentAuthorities() previously returned arrays. Now these methods return Collections. This is a breaking change.
  • ListenableWorker.onStartWork() is renamed to ListenableWorker.startWork() . This is a breaking change.
  • The constructor for WorkStatus is no longer a part of the public API. This is a breaking change.
  • Configuration.getMaxJobSchedulerID() and Configuration.getMinJobSchedulerID() are renamed to Configuration.getMinJobSchedulerId() and Configuration.getMaxJobSchedulerId() respectively. This is a breaking change.
  • Added a lot of @NonNull annotations to the public API to improve ergonomics of the API.
  • Add WorkManager.enqueueUniqueWork() API to enqueue unique OneTimeWorkRequest s without having to create a WorkContinuation .
  • All variants of enqueue and cancel methods on WorkManager now return a new Operation type. This is a breaking change.
  • All variants of enqueue no longer accept varargs for WorkRequest s. This is a breaking change. Use Collections instead. You can use Arrays.asList() to modify existing code. We did this to reduce the API surface and method count.
  • Attempting to initialize WorkManager more than once per process will now result in an IllegalStateException . This is a breaking change.

رفع اشکال

  • WorkRequest.Builder s in the work-runtime-ktx artifact now use ListenableWorker s. Fixes b/117666259
  • Ensure the next run time for PeriodicWork is 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

  • WorkStatus has been renamed to WorkInfo . All corresponding getStatus method variants have been renamed to the corresponding getWorkInfo variants.
  • ListenableWorker.onStopped() no longer accepts has a boolean argument representing if the WorkRequest was cancelled. WorkManager no longer makes this distinction.
  • androidx.work.test package has been renamed to androidx.work.testing package.
  • Setters on Constraints are no longer a part of the public API.
  • WorkerParameters.getTriggeredContentUris() and WorkerParameters.getTriggeredContentAuthorities() previously returned arrays. Now these methods return Collections.
  • ListenableWorker.onStartWork() is renamed to ListenableWorker.startWork() .
  • The constructor for WorkStatus is no longer a part of the public API.
  • Configuration.getMaxJobSchedulerID() and Configuration.getMinJobSchedulerID() are renamed to Configuration.getMinJobSchedulerId() and Configuration.getMaxJobSchedulerId() respectively.
  • All variants of enqueue and cancel methods on WorkManager now return a new Operation type.
  • All variants of enqueue no longer accept varargs for WorkRequest s.
  • Attempting to initialize WorkManager more than once per process will now result in an IllegalStateException .

Version 1.0.0-alpha10

11 اکتبر 2018

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

  • Removed all previously deprecated methods and classes, notably the default Worker constructor. This is a breaking API change.
  • Renamed NonBlockingWorker to ListenableWorker , which is now an unhidden public class and ready for usage.
    • ListenableWorker provides 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 the ListenableFuture appropriately. Reference implementations of ListenableFuture s are provided in the Futures package in alpha02 (see below the WorkManager section).
    • Worker extends ListenableWorker and still operates as before, with an abstract Result doWork() method.
    • Shuffled some methods and members from Worker to ListenableWorker .
    • We shall soon provide reference implementations for ListenableWorker s that use Kotlin coroutines (once the stable versions are released) and RxJava2.
  • The interface WorkerFactory and the concrete implementation DefaultWorkerFactory have been merged into an abstract class called WorkerFactory . The implementation ensures that the default reflection-based behavior is called as a last-ditch effort for any user-created WorkerFactory instances. This is a breaking change.
  • Removed WorkManager.synchronous() and WorkContinuation.synchronous() and all related methods. Added ListenableFuture<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 ListenableFuture s. For example, WorkManager.enqueue() used to return void ; it now returns a ListenableFuture<Void> . You can call ListenableFuture.addListener(Runnable, Executor) or ListenableFuture.get() to run code once the operation is complete.
    • Note that these ListenableFuture s 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 the Future s contract.
    • To maintain parity with the synchronous getStatus* methods, we have provided ListenableFuture variants, and renamed the existing ones that returned LiveData to explicitly have "LiveData" as part of the name (for example, getStatusesByIdLiveData(UUID) ). This is a breaking API change.

رفع اشکال

  • Fixed the known issue from alpha09 regarding duplicate androidx-annotations.pro files. You may remove the workaround from the previous release notes by deleting exclude 'META-INF/proguard/androidx-annotations.pro' from your gradle file.
  • Added proguard configurations to keep new Worker constructor. b/116296569
  • Fix potential NullPointerException in a race condition where work was REPLACE d. b/116253486 and b/116677275
  • WorkContinuation.combine() now accepts one or more WorkContinuation s instead of two or more. b/117266752

Breaking API Changes

  • Removed all previously deprecated methods and classes, notably the default Worker constructor.
  • The interface WorkerFactory and the concrete implementation DefaultWorkerFactory have been merged into an abstract class called WorkerFactory .
  • Removed WorkManager.synchronous() and WorkContinuation.synchronous() .
  • WorkManager.getStatus*() methods now return ListenableFuture s. WorkManager.getStatus*LiveData() return LiveData s.

Version 1.0.0-alpha09

19 سپتامبر 2018

موضوع شناخته شده

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 underlying Worker . 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 LiveData internally.

تغییرات API

  • You can now create your own Worker instances at runtime by specifying a WorkerFactory as part of the WorkManager.Configuration . The fallback factory is DefaultWorkerFactory , which matches behavior of previous versions of WorkManager.
    • The default constructors for Worker and NonBlockingWorker are now marked as deprecated. Please use the new constructor ( Worker(Context, WorkerParameters) ) and call super(Context, WorkerParameters) ; future versions of WorkManager will remove the default constructor.
  • We have started using the new ListenableFuture artifact internally (free of Guava dependencies). We will introduce ListenableFutures to the API in upcoming releases. This change will support the eventual unhiding of NonBlockingWorker .
  • Add ability to trigger timed work in TestDriver via TestDriver.setInitialDelayMet(UUID) and TestDriver.setPeriodDelayMet(UUID) . b/113360060

شکستن تغییرات

  • The default Worker and NonBlockingWorker constructors are deprecated. Please migrate to the new constructor ASAP. Future versions will remove the default constructor.

Version 1.0.0-alpha08

27 آگوست 2018

رفع اشکال

  • 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 Data to indicate the limit is 10KB.
  • Lowered maximum value of Configuration.setMaxSchedulerLimit(int) to 50 to account for some latency in JobScheduler processing completion. b/112817355

Version 1.0.0-alpha07

16 آگوست 2018

رفع اشکال

  • 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 JobScheduler jobs limit. b/111569265
  • Fixed a ConcurrentModificationException in ConstraintTracker . b/112272753
  • Changed return type annotations of Data.getBooleanArray(String) and Data.getIntArray(String) to @Nullable instead of @NonNull . b/112275229

تغییرات API

  • Worker now extends a new class, NonBlockingWorker . This does not affect any current usage. In the future, NonBlockingWorker will become a fully supported entity for custom threading solutions.
  • Changed return type annotations of Data.getBooleanArray(String) and Data.getIntArray(String) to @Nullable instead of @NonNull . b/112275229
  • Kotlin extensions: deprecated Map.toWorkData() and added a top-level workDataOf(vararg Pair<String, Any?>) to be more consistent with existing APIs.

Version 1.0.0-alpha06

1 آگوست 2018

رفع اشکال

  • Prevent a database lock when scheduling work. b/111801342
  • Fix a bug which causes PeriodicWork to not run on schedule when in Doze mode. b/111469837
  • Fix a race condition when tracking constraints which causes WorkManager to crash. googlecodelabs/android-workmanager/issues/56
  • Create unique WorkRequest s when using WorkRequest.Builder#build() . b/111408337
  • Enable the use of RescheduleReceiver only when there are WorkRequest s that need it. b/111765853

Version 1.0.0-alpha05

24 جولای 2018

تغییرات API

  • WorkManager.getInstance() is now annotated with @NonNull instead of @Nullable . Instead, if the singleton isn't properly initialized in cases of manual initialization, the method will throw an IllegalStateException . This is a breaking API change.
  • Added a new API, Configuration.Builder.setMinimumLoggingLevel(int) , which can control WorkManager verbosity. By default, WorkManager logs Log.INFO and above.
  • Changed signature of Data.getString() so it no longer takes a default value (it is implicitly null ). This is a breaking API change.
  • Marked some methods needed only for internal usage as @hide . This includes the Constraints constructor, Data.toByteArray() , and Data.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 PeriodicWorkRequest s when using JobScheduler . b/110798652
  • Fixed an issue with PeriodicWorkRequest s 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 BroadcastReceiver s 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 given WorkRequest . b/111238024

شکستن تغییرات

  • WorkManager.getInstance() is now annotated with @NonNull instead of @Nullable .
  • Changed signature of Data.getString() so it no longer takes a default value (it is implicitly null ).
  • Marked some methods needed only for internal usage as @hide . This includes the Constraints constructor, Data.toByteArray() , and Data.fromByteArray(byte[]) .

Version 1.0.0-alpha04

26 ژوئن 2018

رفع اشکال

  • PeriodicWorkRequest s are now correctly rescheduled when using the AlarmManager based 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

19 ژوئن 2018

رفع اشکال

  • Fixed a race condition in the AlarmManager based implementation. b/80346526 .

  • Fixed duplicate jobs when using JobScheduler after 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-ktx dependency.

  • WorkManager now uses Room version 1.1.1-rc1 .

تغییرات API

  • Added getStatusesSync() , the synchronous version of WorkContinuation.getStatuses() .
  • Worker has the ability to distinguish between user-initiated cancellation and temporary os-requested stopping. Worker.isStopped() returns true if any kind of stop has been requested. Worker.isCancelled() returns true when 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 to JobScheduler or AlarmManager . This helps prevent WorkManager from taking all your available JobScheduler slots.
  • Added Configuration.setJobSchedulerJobIdRange(int minJobSchedulerId, int maxJobSchedulerId) which helps define a range of JobScheduler job ids safe for WorkManager to use. b/79996760
  • Worker.getRunAttemptCount() returns the current run count for a given Worker . b/79716516
  • WorkManager.enqueueUniquePeriodicWork(String uniqueWorkName, ExistingPeriodicWorkPolicy existingPeriodicWorkPolicy, PeriodicWorkRequest periodicWork) allows you to enqueue a unique PeriodicWorkRequest s. b/79600647
  • WorkManager.cancelAllWork() cancels all Worker s. Libraries that depend on WorkManager can query when this method was called last by using WorkManager.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 WorkRequest s, which is the fully qualified class name for the Worker . This allows the ability to remove WorkRequest s without tag s or when the id is not available. b/109572351

شکستن تغییرات

  • Renamed Worker.WorkerResult to Worker.Result .
  • Worker.onStopped now has an additional isCancelled parameter which is set to true when the Worker has explicitly been cancelled.

Version 1.0.0-alpha02

24 مه 2018

رفع اشکال

  • Fixed a NullPointerException on State.isFinished() . b/79550068
  • Fixed an issue which caused Worker s to be rescheduled on Application.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 Worker s to the background thread.
  • The AlarmManager implementation now correctly cleans up when all pending work is complete.
  • Fixed cleanup SQL queries which affected non-English locales. b/80065360
  • Added support for float s in Data . b/79443878
  • Data.Builder.putAll() now returns an instance of the Builder . b/79699162
  • More javadoc and fixes in documentation. b/79691663

تغییرات API

  • Worker s can react to being stopped. Worker.isStopped() can be used to check if a Worker has been stopped. Worker.onStopped() can be used to perform lightweight cleanup operations.
  • Worker.getTags() API returns a Set of tags associated with the Worker .
  • Added javax.time.Duration overloads for APIs which take a combination of duration and TimeUnit s. This is guarded by @RequiresApi(26) .
  • WorkManager extensions have moved from the androidx.work.ktx package to the androidx.work package. The old extensions are deprecated and will be removed in a future version.
  • Configuration.withExecutor() is deprecated. Use Configuration.setExecutor() instead.

Version 1.0.0-alpha01

8 مه 2018

WorkManager simplifies scheduling and execution of guaranteed, constraint-aware background work. This initial release is 1.0.0-alpha01 .