Hi Guys ! I’m getting Trouble In setting user to Geo Relation. (Please Help)
i’m trying to save users location and then update the user property to establish the relation between user and location object.
every thing work fine but issue is when i see the backendless console relation is not established in user’s “Locations” Column .
Here is the Sample code :
private void saveLocation(final BackendlessUser user, double latitude, double longitude) {
List catagory=new ArrayList<String>();
catagory.add(“workshop_locations”);
Map meta=new HashMap<String,Object>();
meta.put(“Workshop_name”,“abc”);
meta.put(“Phone_no”,“123”);
///////////////// Create //////////////////////////////////////////
/////////////////GeoPoint/////////////////////////////////////////
GeoPoint geoPoint=new GeoPoint(latitude,longitude);
geoPoint.setCategories(catagory);
geoPoint.setMetadata(meta);
////////////////////////////Call API///////////////////////////////////
//////////////////////////////////////////////////////////////////////
Backendless.Geo.savePoint(geoPoint ,new AsyncCallback<GeoPoint>() {
@Override
public void handleResponse(GeoPoint response) {
user.setProperty(“locations”,response);
updateUser(user);
}
@Override
public void handleFault(BackendlessFault fault) {
Log.i(“LoactionError”,fault.getMessage());
}
});
}
then update the user :
private void updateUser(BackendlessUser user){
Backendless.UserService.update(user, new AsyncCallback<BackendlessUser>() {
@Override
public void handleResponse(BackendlessUser backendlessUser) {
Toast.makeText(getActivity(), “user is updated”, Toast.LENGTH_SHORT).show();
}
@Override
public void handleFault(BackendlessFault backendlessFault) {
log.i(“UserUpdateError”,fault.getMessage());
}
});
}
Every thing works fine but when i see Backendless console then there is no relation established between user and location but location is saved . (Screen shot is attached)