Skip to content

Instantly share code, notes, and snippets.

@parahall
Created May 7, 2018 21:27
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/f0ae636308b4ae84a43e0335695ae865 to your computer and use it in GitHub Desktop.
Save parahall/f0ae636308b4ae84a43e0335695ae865 to your computer and use it in GitHub Desktop.
//Create constraints
Constraints constraints = new Constraints.Builder().setRequiredNetworkType
(NetworkType.CONNECTED).build();
//create work
Work uploadWork = new Work.Builder(LocationUploadWorker.class).withConstraints
(constraints).build();
//schedule work
WorkManager.getInstance(this).enqueue(uploadWork);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment