Skip to content

Instantly share code, notes, and snippets.

@parahall
Created May 7, 2018 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parahall/985bcf79f382149fb9ca09a86e3fc854 to your computer and use it in GitHub Desktop.
Save parahall/985bcf79f382149fb9ca09a86e3fc854 to your computer and use it in GitHub Desktop.
Constraints constraints = new Constraints.Builder().setRequiredNetworkType
(NetworkType.CONNECTED).build();
PeriodicWork locationWork = new PeriodicWork.Builder(LocationWork.class,
FIVETEEN_MIN, TimeUnit.MILLISECONDS).addTag(LocationWork.TAG)
.withConstraints(constraints).build();
WorkManager.getInstance(this).enqueue(locationWork);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment