use of com.github.moko256.twitlatte.rx.LocationSingleBuilder in project twicalico by moko256.
the class PostActivity method updateLocation.
private void updateLocation() {
LocationManager locationManager = (LocationManager) getApplicationContext().getSystemService(LOCATION_SERVICE);
disposable.add(new LocationSingleBuilder(Objects.requireNonNull(locationManager)).getSingle().subscribe(it -> {
model.getUpdateStatus().setLocation(new Pair<>(it.getLatitude(), it.getLongitude()));
locationText.setText(getString(R.string.lat_and_lon, it.getLatitude(), it.getLongitude()));
}, this::errorNotify));
}
Aggregations