[英]Newest Quickblox SDK for Android: Get nearby locations does not work
I have been using Quickblox SDK for Android for quite a while. 我已经使用Android的Quickblox SDK已有一段时间了。 However, the new SDK library made some of my code not working.
但是,新的SDK库使我的某些代码无法正常工作。 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"]}}'
'{“错误”:{“当前位置”:[“应采用GeoPoint格式”,“应设置半径”]}}'
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. 我可以搜索所有位置,并获得所需的位置,但这并不像使用SDK那样优雅。
If I just replace Quickblox SDK with the earlier version it works fine. 如果我只是将Quickblox SDK替换为早期版本,则可以正常工作。
Looks like it was fixed in 1.2.4 看起来它已在1.2.4中修复
http://quickblox.com/developers/Android#Framework_changelog : http://quickblox.com/developers/Android#Framework_changelog :
which version do you use? 您使用哪个版本?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.