Get location form server as Geopoint or Location

Hi. I have problem to getting user location from server. I’m trying to get info like this

GeoPoint.create(String.valueOf(user.getProperties().get("location")))

But it is doesn’t work, and returning me null. How can I get location from BackendlessUser? Maybe you have some example?

Best Regards.

Gleb

Hi, Gleb
Have you checked the “autoload” checkbox that’s in the top of your relations column(“location”) in Users table?

Hi, thanks for response. What is this checkbox mean?

It means that you will autoload the relations of the record by default

So i tried as you said. And now I’m getting exception

java.lang.NumberFormatException: Invalid double: “GeoPoint{objectId=‘5C6E7ED1-3532-D29D-FFCC-40A5DDBE5E00’”

Location location = new Location(LOCATION);
if(user.getProperties().get(LOCATION) != null) {
    double latitude = GeoPoint.create(String.valueOf(user.getProperties().get(LOCATION))).getLatitude();
    double longitude = GeoPoint.create(String.valueOf(user.getProperties().get(LOCATION))).getLongitude();
    location.setLatitude(latitude);
    location.setLongitude(longitude);
}

In latitude and longitude varibles… Why am I getting the objectId of user instead of location?

What is you appID?