I have been using Quickblox SDK for Android for quite a while. However, the new SDK library made some of my code not working. Specifically, I create list of locations. Then I try to search for nearby locations, providing current location and radius.
getLocationsBuilder.setCurrentPosition(qbLocation.getLatitude(), qbLocation.getLongitude()); getLocationsBuilder.setRadius(point.getLatitude(), point.getLongitude(), (float) 5.0); GeoPoint point = new GeoPoint(qbLocation.getLatitude(), qbLocation.getLongitude());
However, I get the result that format is incorrect.
{"errors":{"current_position":["should be in GeoPoint format","should be set with radius"]}}
Here is my whole code:
Log.d(TAG, "update location is " + point.getLatitude() + " " + point.getLongitude()); QBLocationRequestBuilder getLocationsBuilder = new QBLocationRequestBuilder(); getLocationsBuilder.setPage(1); getLocationsBuilder.setPerPage(100); getLocationsBuilder.setLastOnly(); getLocationsBuilder.setCurrentPosition(qbLocation.getLatitude(), qbLocation.getLongitude()); getLocationsBuilder.setRadius(point.getLatitude(), point.getLongitude(), (float) 5.0); int unixTime = (int) (System.currentTimeMillis() / 1000L - 1000); getLocationsBuilder.setMinCreatedAt(unixTime); // getLocationsBuilder.setSort(SortField.DISTANCE); QBLocations.getLocations(getLocationsBuilder, new QBEntityCallback<ArrayList<QBLocation>>() { @Override public void onSuccess(ArrayList<QBLocation> qbLocations, Bundle bundle) { ArrayList<String> card_ids = new ArrayList<String>(); for (QBLocation location : qbLocations) { Log.d(TAG, "locations nearby : " + location); card_ids.add(location.getStatus()); // status is card_id } getCards(card_ids); } @Override public void onSuccess() { } @Override public void onError(List<String> strings) { } });
I can search for all locations, and get the ones which I want, but that is not so elegant as using SDK.
If I just replace Quickblox SDK with the earlier version it works fine.