Created
May 10, 2018 17:37
-
-
Save parahall/e79111e235bf0b02ac7177ae2f7ff548 to your computer and use it in GitHub Desktop.
This file contains 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
public class LocationUploadWorker extends Worker { | |
//... | |
public WorkerResult doWork() { | |
//get Data out from input | |
double longitude = getInputData().getDouble(LOCATION_LONG, 0); | |
double latitude = getInputData().getDouble(LOCATION_LAT, 0); | |
long time = getInputData().getLong(LOCATION_TIME, 0); | |
String osVersion = "WorkerReport v" + Build.VERSION.SDK_INT; | |
//construct our report for server format | |
ServerReport serverReport = new ServerReport(longitude, latitude, time); | |
//Report it to firebise server | |
FirebaseDatabase database = FirebaseDatabase.getInstance(); | |
DatabaseReference myRef = database.getReference(osVersion); | |
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