我曾尝试在解析中应用geopoints,但我无法进行查询。代码如下。
ParseObject placeObject = new ParseObject("placeObject");
ParseGeoPoint userLocation = (ParseGeoPoint) placeObject.get("location");
ParseQuery query = new ParseQuery("PlaceObject");
query.whereNear("location", userLocation);
query.setLimit(10);
query.findInBackground(new FindCallback() {
public void done(List<ParseObject> Locaciones, ParseException e) {
if (e == null) {
Log.d("ERROR",Locaciones.toString());
// object will be your game score
} else {
Log.d("ERROR",e.toString());
// something went wrong
}
}
});
答案 0 :(得分:0)
试试这个:
ParseObject.registerSubclass(MasterEntity.class);
ParseGeoPoint userLocation = new ParseGeoPoint(latitude,longitude);
ParseQuery<MasterEntity> query = ParseQuery.getQuery("UserMaster");
query.whereNear("location", userLocation);
query.setLimit(30);
query.findInBackground(new FindCallback<MasterEntity>() {
@Override
public void done(List<MasterEntity> mlist, ParseException e) {
dlg.dismiss();
if (e==null) {
for (int i = 0; i < mlist.size(); i++) {
MasterEntity cc = mlist.get(i);
String s_email = cc.getEmail();
String s_uname = cc.getuserName();
String s_objid = cc.getObjectID();
List<ParseObject> aryFollower = cc.getFollowers();
List<ParseObject> aryFollowing = cc.getFollowing();
}
}
else
{
Alert.alertOneBtn(getActivity(),"Something went wrong.Please try again later");
}
}
});
示例应用:https://github.com/ParsePlatform/AnyWall/tree/master/AnyWall-android