Created
December 14, 2020 22:42
-
-
Save SergejIsbrecht/07ff3e008a2afb5cdd479b25ada80e77 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
myLocationService.getLocation() | |
.flatMapSingle(new Function<Location, Single<DistanceResponseModel>>() { | |
@Override | |
public Single<DistanceResponseModel> apply(@NonNull Location location) throws Exception { | |
return distanceRepository.distanceResponseAPI(location.getLatitude() + "," + location.getLongitude(), getDestinations(), "my_google_api_key") | |
.subscribeOn(Schedulers.io()); | |
} | |
}) | |
.subscribe(new Subscriber<DistanceResponseModel>() { | |
or | |
myLocationService.getLocation() | |
.observeOn(Schedulers.io()); | |
.flatMapSingle(new Function<Location, Single<DistanceResponseModel>>() { | |
@Override | |
public Single<DistanceResponseModel> apply(@NonNull Location location) throws Exception { | |
return distanceRepository.distanceResponseAPI(location.getLatitude() + "," + location.getLongitude(), getDestinations(), "my_google_api_key") | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment