private void publishStory() {
Session session = Session.getActiveSession();
if (session != null){
// Check for publish permissions
List<String> permissions = session.getPermissions();
if (!isSubsetOf(PERMISSIONS, permissions)) {
pendingPublishReauthorization = true;
Session.NewPermissionsRequest newPermissionsRequest = new Session
.NewPermissionsRequest(this, PERMISSIONS);
session.requestNewPublishPermissions(newPermissionsRequest);
return;
}
Bundle postParams = new Bundle();
postParams.putString("name", "옷가게");
postParams.putString("caption", "-girls day-");
postParams.putString("description", "걸스데이랑께");
postParams.putString("link", "http://www.naver.com");
postParams.putString("picture", "http://imgtest.monkey3.co.kr/get_image.php?type=album&id=185582&w=100");
Request.Callback callback= new Request.Callback() {
public void onCompleted(Response response) {
JSONObject graphResponse = response
.getGraphObject()
.getInnerJSONObject();
String postId = null;
try {
postId = graphResponse.getString("id");
} catch (JSONException e) {
// Log.i(TAG,
// "JSON error "+ e.getMessage());
}
FacebookRequestError error = response.getError();
// if (error != null) {
// Toast.makeText(getActivity()
// .getApplicationContext(),
// error.getErrorMessage(),
// Toast.LENGTH_SHORT).show();
// } else {
// Toast.makeText(getActivity()
// .getApplicationContext(),
// postId,
// Toast.LENGTH_LONG).show();
// }
}
};
Request request = new Request(session, "me/feed", postParams,
HttpMethod.POST, callback);
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
}
}
private boolean isSubsetOf(Collection<String> subset,
Collection<String> superset) {
for (String string : subset) {
if (!superset.contains(string)) {
return false;
}
}
return true;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
}
이런 식으로 되는데.....
실제로 하고싶은건 이런식의 연동입니다.....
마지막 그림에서 ㅎㅇ 라는 메세지로 같이 올라가는데 저의 소스에서 다이얼로그를 이용해서 할려고하니...쓰레드 문제가 발생해서 안되는거 같습니다....
다이얼 로그 써서 하고싶은데 큰 도움 주세요 ㅠㅠㅠㅠㅠㅠㅠㅠ