Last active
August 29, 2015 14:09
-
-
Save henocdz/fcf11f182bf7535fe3a0 to your computer and use it in GitHub Desktop.
Android+Parse GeoSpatial Query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Assuming that you have "Google Play Services" configured | |
| //protected LocationClient mLocationClient; | |
| //mLocationClient = new LocationClient(this, this, this); | |
| // protected Location mLocation; | |
| float DISTANCE = 0.2; | |
| mLocation = mLocationClient.getLastLocation(); | |
| ParseQuery<ParseObject> places = ParseQuery.getQuery("AParseClass"); | |
| Log.i(LOG_TAG, mLocation.toString()); | |
| places.whereWithinKilometers("location", new ParseGeoPoint(mLocation.getLatitude(), mLocation.getLongitude()), DISTANCE); | |
| places.findInBackground(new FindCallback<ParseObject>() { | |
| @Override | |
| public void done(List<ParseObject> parseObjects, ParseException e) { | |
| for(ParseObject place : parseObjects){ | |
| Log.i(LOG_TAG, place.getString("AClassColumn")); | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment