Hi Artur,
I checked this example, but there is no way to use “save” method with map to add data into “Users” table.
Also I cannot understand why when i’m trying to get the property “location” from Users table returns null .
Thanks
GeoPoint point = new GeoPoint();
point.setLatitude(40.7148);
point.setLongitude(-74.0059);
BackendlessUser user = Backendless.UserService.CurrentUser();
user.setProperty("location", point);
Backendless.Persistence.of(BackendlessUser.class).save(user, new AsyncCallback<BackendlessUser>() {
@Override
public void handleResponse(BackendlessUser user) {
BackendlessDataQuery query = new BackendlessDataQuery("distance(40.7148,-74.0059, location.latitude, location.longitude ) < km(10000)");
Backendless.Persistence.of(BackendlessUser.class).find(query, new AsyncCallback<BackendlessCollection<BackendlessUser>>() {
@Override
public void handleResponse(BackendlessCollection<BackendlessUser> response) {
Log.i("test","name :" + (GeoPoint)response.getData().get(0).getProperty("location")); // return null
Log.i("test","name :" + response.getData().get(0).getProperty("location")); // return null
Log.i("test","name :" + response.getData().get(0).getProperty("location.latitude"));// return null
Log.i("test","name :" + response.getData().get(0).getProperties());//Everything returns to correctly except location
}
@Override
public void handleFault(BackendlessFault backendlessFault) {
}
});
}
@Override
public void handleFault(BackendlessFault backendlessFault) {
}
});
For update exist geoPoint which is assigned to user [url=https://backendless.com/documentation/geo/rest/geo_updating_a_geo_point.htm]https://backendless.com/documentation/geo/rest/geo_updating_a_geo_point.htm[/url]
For assign a new geoPoint to user object [url=https://backendless.com/documentation/data/rest/data_relations_with_geo_points.htm]https://backendless.com/documentation/data/rest/data_relations_with_geo_points.htm[/url]
Regards, Vlad