Tell if a location is a mock
Этот коммит содержится в:
@@ -80,7 +80,8 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
"speed REAL," +
|
||||
"course REAL," +
|
||||
"accuracy REAL," +
|
||||
"battery REAL)");
|
||||
"battery REAL," +
|
||||
"mock INTEGER)");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,6 +101,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
values.put("course", position.getCourse());
|
||||
values.put("accuracy", position.getAccuracy());
|
||||
values.put("battery", position.getBattery());
|
||||
values.put("mock", position.getMock() ? 1 : 0);
|
||||
|
||||
db.insertOrThrow("position", null, values);
|
||||
}
|
||||
@@ -133,6 +135,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
position.setCourse(cursor.getDouble(cursor.getColumnIndex("course")));
|
||||
position.setAccuracy(cursor.getDouble(cursor.getColumnIndex("accuracy")));
|
||||
position.setBattery(cursor.getDouble(cursor.getColumnIndex("battery")));
|
||||
position.setMock(cursor.getInt(cursor.getColumnIndex("mock")) > 0);
|
||||
|
||||
} else {
|
||||
return null;
|
||||
|
||||
@@ -37,6 +37,7 @@ public class Position {
|
||||
accuracy = location.getAccuracy();
|
||||
}
|
||||
this.battery = battery;
|
||||
this.mock = location.isFromMockProvider();
|
||||
}
|
||||
|
||||
private long id;
|
||||
@@ -139,4 +140,14 @@ public class Position {
|
||||
this.battery = battery;
|
||||
}
|
||||
|
||||
private boolean mock;
|
||||
|
||||
public boolean getMock() {
|
||||
return mock;
|
||||
}
|
||||
|
||||
public void setMock(boolean mock) {
|
||||
this.mock = mock;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,6 +36,10 @@ public class ProtocolFormatter {
|
||||
.appendQueryParameter("accuracy", String.valueOf(position.getAccuracy()))
|
||||
.appendQueryParameter("batt", String.valueOf(position.getBattery()));
|
||||
|
||||
if (position.getMock()) {
|
||||
builder.appendQueryParameter("mock", String.valueOf(position.getMock()));
|
||||
}
|
||||
|
||||
if (alarm != null) {
|
||||
builder.appendQueryParameter("alarm", alarm);
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user