Hi,
I’m trying to do a request to get the near places to my current location. I’m taken a look at this article (https://backendless.com/feature-103-search-data-objects-by-distance-from-a-location/) Yes, seems easy but I can’t do that works…
This is my class to match with the table in the data base:
public class Beach {
private String city;
private String country;
private String name;
private String description;
private GeoPoint location;
public Beach(){}
.
. //All getter and setters
.
And this is my method: If I remove whereClause I can get the data and works fine, but if I put whereClause is when I have the problem and seems that don’t do nothing. Don’t go throught the AsynCallback method.
String query = “distance( %f, %f, location.latitude, location.longitude ) < km(1000)”;
String whereClause = String.format( query, currentLatitude, currentlongitude );
BackendlessDataQuery dataQuery = new BackendlessDataQuery(whereClause);
QueryOptions queryOptions = new QueryOptions();
queryOptions.addRelated( “location” );
dataQuery.setQueryOptions( queryOptions );
Backendless.Data.of(Beach.class).find(dataQuery, new AsyncCallback<BackendlessCollection<Beach>>() {
@Override
public void handleResponse(final BackendlessCollection<Beach> response) {
.
.
.
I have check autoload in column location in my table Beach in the data base
I’ve attached a screen of my debug so you can see the data that I’m trying to retrieve and the format string that I’m doing.
I do not see property called “available” in your class, but you reference it in the whereClause query.
Yes, I’m sorry about this Mark. I just editing and changed the question, but is still doesn’t work. Look my updated attached file and query, please.
Yeah, Thank you so much!
The problem is that Location object in Android get the latitude and longitude with , and not with .