如何在android中找到基于当前lat和long使用Parse API(parse.com)的最近地点

puj*_*tav 5 android geolocation parse-platform

我想找到最近的地方使用解析API.当我输入城市名称时,我必须找到所有最近的地方,根据当前的纬度和经度.我的关键字将在解析数据库中.请告诉我怎么办it.Here是我试过的示例代码

//for finding the nearest places
    ParseGeoPoint point = new ParseGeoPoint(17.5, -54.2); 
    ParseObject object = new ParseObject("Places");
    object.put("hyderabad", point); 
    object.save();
Run Code Online (Sandbox Code Playgroud)

Arc*_*yne 2

您是否尝试过whereWithinKilometers、whereWithinMiles 或whereWithinRadians

检查右侧菜单中的ParseQuery 。

您的代码将类似于:

ParseGeoPoint userLocation = (ParseGeoPoint) userObject.get("location");
ParseQuery query = new ParseQuery("PlaceObject");
query.whereWithinKilometers("location", userLocation);
query.findInBackground(new FindCallback() { ... });
Run Code Online (Sandbox Code Playgroud)