Last active
October 20, 2018 10:26
-
-
Save adriantache/871403b423bd7d6e380fbda4bad0e3c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//WARNING: this code is no longer valid as of WorkManager-alpha-10, please | |
//refer to this post for more details: https://medium.com/p/8e49c463cbf7 | |
//finally, we get the status from the WorkManager by id since we still have | |
//a reference, otherwise we could do it by tag, and create an observer which | |
//checks whether the Worker has succeeded (i.e. returned Worker.Result.SUCCESS) | |
WorkManager.getInstance() | |
.getStatusById(getEventJson.getId()) | |
.observe(MainActivity.this, workStatus -> { | |
if (workStatus != null && workStatus.getState().equals(State.SUCCEEDED)) { | |
//if we have success, we trigger post-work tasks | |
onWorkCompleted(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment