从restfb获取经纬度
Get latitude, longitude from restfb
我以前用fql从Place获取经纬度。
现在我该怎么做?我得到了用户的位置,但只填写了id和name。其他都是空的。代码:
FacebookClient fc = new DefaultFacebookClient(token, Version.VERSION_2_9);
User user = fc.fetchObject("me", User.class, Parameter.with("location"));
Location loc = fc.fetchObject(user.getLocation().getId(), Location.class);
也尝试过:
Place pl = fc.fetchObject(user.getLocation().getId(), Place.class);
同样的事情。
正如我在 RestFB 中所写 bugtracker:
FacebookClient fc = new DefaultFacebookClient(token, Version.VERSION_2_9);
User user = fc.fetchObject("me", User.class, Parameter.with("fields","location"));
Page pageOfUserLocation = fc.fetchObject(user.getLocation().getId(),
Page.class, Parameter.with("fields","location");
if (pageOfUserLocation.getLocation() != null) {
System.out.println("longitude: ", pageOfUserLocation.getLocation().getLongitude());
System.out.println("latitude: ", pageOfUserLocation.getLocation().getLatitude());
}
我以前用fql从Place获取经纬度。
现在我该怎么做?我得到了用户的位置,但只填写了id和name。其他都是空的。代码:
FacebookClient fc = new DefaultFacebookClient(token, Version.VERSION_2_9);
User user = fc.fetchObject("me", User.class, Parameter.with("location"));
Location loc = fc.fetchObject(user.getLocation().getId(), Location.class);
也尝试过:
Place pl = fc.fetchObject(user.getLocation().getId(), Place.class);
同样的事情。
正如我在 RestFB 中所写 bugtracker:
FacebookClient fc = new DefaultFacebookClient(token, Version.VERSION_2_9);
User user = fc.fetchObject("me", User.class, Parameter.with("fields","location"));
Page pageOfUserLocation = fc.fetchObject(user.getLocation().getId(),
Page.class, Parameter.with("fields","location");
if (pageOfUserLocation.getLocation() != null) {
System.out.println("longitude: ", pageOfUserLocation.getLocation().getLongitude());
System.out.println("latitude: ", pageOfUserLocation.getLocation().getLatitude());
}