Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class LocationUploadWorker extends Worker {
@Override
public WorkerResult doWork() {
Location location = LocationRepository.getLastLocation();
ServerReport serverReport = new ServerReport(location);
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