Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@parahall
Created May 10, 2018 05:57
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/a3d9c93a1fd8b2f2db1a3db26a78584f to your computer and use it in GitHub Desktop.
Save parahall/a3d9c93a1fd8b2f2db1a3db26a78584f to your computer and use it in GitHub Desktop.
public class LocationUploadWorker extends Worker {
...
//Upload last passed location to the server
public WorkerResult doWork() {
ServerReport serverReport = new ServerReport(getInputData().getDouble(LOCATION_LONG, 0),
getInputData().getDouble(LOCATION_LAT, 0), getInputData().getLong(LOCATION_TIME,
0));
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference myRef =
database.getReference("WorkerReport v" + android.os.Build.VERSION.SDK_INT);
myRef.push().setValue(serverReport);
return WorkerResult.SUCCESS;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment