I'd like to get Locations inside of a rectangle. This is my code:
public void getRadarUsers() {
double latitude1,longitude1,latitude2,longitude2;
latitude1 = CommonProperties.map.getProjection().getVisibleRegion().latLngBounds.southwest.latitude;
longitude1 = CommonProperties.map.getProjection().getVisibleRegion().latLngBounds.southwest.longitude;
latitude2 = CommonProperties.map.getProjection().getVisibleRegion().latLngBounds.northeast.latitude;
longitude2 = CommonProperties.map.getProjection().getVisibleRegion().latLngBounds.northeast.longitude;
QBLocationRequestBuilder getLocationsBuilder = new QBLocationRequestBuilder();
getLocationsBuilder.setPerPage(10); // only 10 locations
getLocationsBuilder.setGeoRect(latitude1, longitude1, latitude2,
longitude2);
QBLocations.getLocations(getLocationsBuilder, new QBCallbackImpl() {
@Override
public void onComplete(Result result) {
if (result.isSuccess()) {
QBLocationPagedResult locationsResult = (QBLocationPagedResult) result;
if (locationsResult.getLocations() != null) {
for (QBLocation location : locationsResult
.getLocations()) {
UserVO user = new UserVO();
user.setLocation(location);
user.setUser(location.getUser());
QBCommon.getFileService().getUserFile(user);
}
}
}
}
});
}
Log for Request: 12-08 16:31:29.505: D/QBASDK RestRequest(29104): PARAMETERS 12-08 16:31:29.505: D/QBASDK RestRequest(29104): per_page=10 12-08 16:31:29.505: D/QBASDK RestRequest(29104): geo_rect=49.578363078876166;6.082663312554359;49.63331730521349;6.137594617903233 12-08 16:31:29.505: D/QBASDK RestRequest(29104): INLINE 12-08 16:31:29.505: D/QBASDK RestRequest(29104): GET https://api.quickblox.com/geodata/find.json?per_page=10&geo_rect=49.578363078876166;6.082663312554359;49.63331730521349;6.137594617903233
Log for Response: 12-08 16:31:31.997: D/QBASDK RestResponse(29104): BODY 12-08 16:31:31.997: D/QBASDK RestResponse(29104): '{"errors":{"geo_rect":["should be in GeoRect format"]}}' 12-08 16:31:32.005: D/QBASDK QBLocationPagedResult(29104): Request has been completed with error: [geo_rect should be in GeoRect format]
As you can read the error is: geo_rect:should be in GeoRect format.
The values for latitude and longitude are:
latitude1 = 49.578363078876166 longitud1 = 6.082663312554359
latitude2 = 49.63331730521349 longitud2 = 6.137594617903233
Any idea about the error please?
Thanks in advance.
UPDATED: I'm using Andoid SDK and QuickBlox version is 0.8.1 If I use QuickBlox version is 0.8. I don't get any error and I can get Locations. it seems to be a bug. does anybody know how to report it? Thanks
Check out latest QuickBlox Android SDK 0.8.2 here http://quickblox.com/developers/Android#Download_Android_SDK This feature works without any problems