Skip to content

Instantly share code, notes, and snippets.

@robertlevonyan
Last active March 6, 2019 12:13
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 robertlevonyan/5e821bc3ae9e4224d2d1bbea486f6dcb to your computer and use it in GitHub Desktop.
Save robertlevonyan/5e821bc3ae9e4224d2d1bbea486f6dcb to your computer and use it in GitHub Desktop.
class LocationWorker(context: Context, workerParams: WorkerParameters)
: Worker(context, workerParams) {
...
override fun doWork(): Result {
val latitude = inputData.getDouble(KEY_LATITUDE, 40.1903484)
val longitude = inputData.getDouble(KEY_LONGITUDE, 44.5148367)
val sendDataService = SendDataService.getInstance()
sendDataService.sendLocation(latitude, longitude)
.addSuccessCallback {
// do smth
}
.addFailureCallback {
// do smth
}
return Result.success()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment