aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/location/OpenCellIdLocationProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/location/OpenCellIdLocationProvider.java')
-rw-r--r--src/org/traccar/location/OpenCellIdLocationProvider.java36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/org/traccar/location/OpenCellIdLocationProvider.java b/src/org/traccar/location/OpenCellIdLocationProvider.java
index b06f44d1e..94cc1a4e4 100644
--- a/src/org/traccar/location/OpenCellIdLocationProvider.java
+++ b/src/org/traccar/location/OpenCellIdLocationProvider.java
@@ -38,26 +38,26 @@ public class OpenCellIdLocationProvider extends BaseLocationProvider {
protected void getLocation(int mcc, int mnc, long lac, long cid, final LocationProviderCallback callback) {
Context.getAsyncHttpClient().prepareGet(String.format(url, mcc, mnc, lac, cid))
.execute(new AsyncCompletionHandler() {
- @Override
- public Object onCompleted(Response response) throws Exception {
- try (JsonReader reader = Json.createReader(response.getResponseBodyAsStream())) {
- JsonObject json = reader.readObject();
- if (json.containsKey("lat") && json.containsKey("lon")) {
- callback.onSuccess(
- json.getJsonNumber("lat").doubleValue(),
- json.getJsonNumber("lon").doubleValue());
- } else {
- callback.onFailure();
- }
- }
- return null;
- }
-
- @Override
- public void onThrowable(Throwable t) {
+ @Override
+ public Object onCompleted(Response response) throws Exception {
+ try (JsonReader reader = Json.createReader(response.getResponseBodyAsStream())) {
+ JsonObject json = reader.readObject();
+ if (json.containsKey("lat") && json.containsKey("lon")) {
+ callback.onSuccess(
+ json.getJsonNumber("lat").doubleValue(),
+ json.getJsonNumber("lon").doubleValue());
+ } else {
callback.onFailure();
}
- });
+ }
+ return null;
+ }
+
+ @Override
+ public void onThrowable(Throwable t) {
+ callback.onFailure();
+ }
+ });
}
}