Skip to content

Issue/10572 update work manager#13542

Merged
malinajirka merged 8 commits intodevelopfrom
issue/10572-update-work-manager
Dec 7, 2020
Merged

Issue/10572 update work manager#13542
malinajirka merged 8 commits intodevelopfrom
issue/10572-update-work-manager

Conversation

@malinajirka
Copy link
Copy Markdown
Contributor

@malinajirka malinajirka commented Dec 4, 2020

Fixes #10572

I'm not able to replicate the issue. This PR updates androidx.work: to it's newest stable version (2.4.0).

Release notes are here.

I recommend reviewing this PR by commits:

  • 67ae870 - v2.1.0 requires java 8 (see this)
  • 6c5d9e5 - lifecycle-extensions was deprecated, this PR adds required dependencies explicitly (see this)
  • 9f3a445 - ViewModelProviders were removed with the deprecation of lifecycle-extensions
  • f594c57 implemented on demand initialization of the Worker, reverted this change in eb0c774 since we schedule a periodic worker on apps startup anyway
  • f1b5039 - updated usages of deprecated WorkManager.getInstance() with WorkManager.getInstance(context)
  • 82b0c50 - use GCMNetworkManager on API <= 22 (see this)

To test - test on a newer API and API <= 22

  1. Start the app in airplane mode
  2. Create a new post, write a title, press Publish
  3. Close the app.
  4. Turn off airplane mode.
  5. Make sure your device is not on data roaming.
  6. Notice the the post gets uploaded almost immediately

Run adb shell dumpsys jobscheduler (API 23+) and find the periodic task in the list.
Note: I spent quite some time investigating why JobInfo for the periodic task doesn't contain

PERIODIC: interval=+8h0m0s0ms flex=+6h0m0s0ms

It does contain this line when running the app before this PR. I haven't find any information in docs about this change, but I tried switching the interval for the task to "15 minutes" and flex to "5 minutes" and verified it runs periodically.

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@malinajirka malinajirka added this to the 16.4 milestone Dec 4, 2020
@peril-wordpress-mobile
Copy link
Copy Markdown

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link
Copy Markdown

You can test the changes on this Pull Request by downloading the APK here.

Copy link
Copy Markdown
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @malinajirka 👍
I performed a few tests with different network conditions and post types posts/pages/stories with/without attached media and everything works as expected 🎉
The code changes look consistent👍

@malinajirka malinajirka merged commit 497da6e into develop Dec 7, 2020
@malinajirka malinajirka deleted the issue/10572-update-work-manager branch December 7, 2020 15:53
@malinajirka malinajirka mentioned this pull request Dec 7, 2020
3 tasks
ParaskP7 added a commit that referenced this pull request Feb 6, 2023
This dependency was added as part of this
82b0c50 commit (see PR below), which
supported the use of GCMNetworkManager as a scheduler when Google Play
Services is available for API levels <= 22. This was an optional
dependency that helped with more reliable and performant background
processing on older API versions as GCMNetworkManager on api <= 22 (see
2.2.0 release notes below). However, since this project is now on
api >= 24 (see 'minSdkVersion'), this dependency is no longer
necessary and thus can be removed.

- PR: Issue/10572 update work manager #13542
#13542
- Work Manager 2.2.0: https://developer.android.com/jetpack/androidx/
releases/work#2.2.0

------------------------------------------------------------------------

Also, the 'Dependency Analysis' plugin advised in favor of that removal,
thus, it is most probably safe to do this removal at this point:

Dependencies which should be removed or changed to runtime-only:
  runtimeOnly 'androidx.work:work-gcm:2.7.1' (was implementation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IllegalStateException: Cannot perform this operation because there is no current transaction.

2 participants