我想在android中更新用户的状态以及用户的位置。我有纬度,经度和位置的名称。 我已经更新了状态,但无法弄清楚如何将其与位置一起发布。
Session session = Session.getActiveSession();
Request.Callback callback = new Request.Callback() {
@Override
public void onCompleted(Response response) {
Log.d("Checkin", response.toString());
Toast.makeText(context, response.toString(),
Toast.LENGTH_LONG).show();
}
};
if (session != null && session.isOpened()) {
Request.newStatusUpdateRequest(session,
"Posting from my fyp", null, null, callback)
.executeAsync();
}
答案 0 :(得分:0)
我们可以使用最新的Facebook SDK执行此操作:
Location location = new Location("provider");
location.setLatitude(13.1234);
location.setLongitude(13.1234);
final Session session = Session.getActiveSession();
Request placesSearchRequest = Request.newPlacesSearchRequest(session, location, 100,
1, "",
new GraphPlaceListCallback() {
@Override
public void onCompleted(List<GraphPlace> places, Response response) {
Request statusUpdateRequest = Request.newStatusUpdateRequest(session, "Hell Yea :P #fyp #success #viaCheckinApp",
places.get(0), null, new Callback() {
@Override
public void onCompleted(Response response) {
debug("response of posting checkin to facebook: " + response.toString());
}
});
statusUpdateRequest.executeAsync();
}
});
placesSearchRequest.executeAsync();