2013-06-11 2 views
2

Facebook sdk 3.1을 사용하는 Android 애플리케이션에서 페이지의 타임 라인/벽에 링크를 게시하려면 어떻게해야합니까? 도움을 주시기 바랍니다. 미리 감사드립니다. Plese는이 질문에 투표하지 않습니다. 나는 pageid/feed를 사용하여 게시하려고 시도했습니다. 그러나 페이지의 소유자가 게시 한 "페이지 이름에 대한 다른 사람의 최근 게시물"아래에 표시되어 있습니다. 표시해야합니다. 이 가이드는 어떻게 Facebook SDK for Android로 개발을 시작하는 방법을 보여줍니다Facebook sdk를 사용하여 Facebook 페이지의 링크를 게시하십시오. 3.1

Bundle postParams = new Bundle(); 
postParams.putString("message","message");    
postParams.putString("name","name"); 
postParams.putString("link",link); 
postParams.putString("picture",picture); 
postParams.putString("display", "page"); 

Request.Callback callback = new Request.Callback() { 

public void onCompleted(Response response) { 
    FacebookRequestError error = response.getError(); 
                if (error != null) { 
    Log.e("FACEBOOK ERROR", ""+ error.getErrorMessage()); 
      } else { 
                 JSONObject graphResponse = response 
                   .getGraphObject() 
                   .getInnerJSONObject(); 
                 String postId = null; 
                 try { 
                  postId = graphResponse 
                    .getString("id"); 
                 } catch (JSONException e) { 
                 } 
               } 
} 
}; 

Request request = new Request(session,pageid+"/feed",postParams, HttpMethod.POST,callback); 
RequestAsyncTask task = new RequestAsyncTask(request); 
task.execute(); 
+0

페이지에 게시하는 방법과 그래프 요청의 경로로 사용하는 끝점은 무엇입니까? 페이지 게시물 관리에 대한이 문서를 읽었습니까? - https://developers.facebook.com/docs/reference/api/page/#post_types –

+0

@MingLi 코드 – user1767260

+0

을 추가했습니다. manage_pages 권한이 있습니까? –

답변

3

을 게시 로그인 요청, 선택기, 사진 업로드 및 오픈 그래프를 사용하는 방법을 보여줍니다 wall의 경우 세션 값은 null이어야하며 페이지의 access_token을 post 매개 변수로 추가하십시오.

Bundle postParams = new Bundle(); 
postParams.putString("message","message");    
postParams.putString("name","name"); 
postParams.putString("link",link); 
postParams.putString("picture",picture); 
postParams.putString("access_token", pageaccessToken); 

Request.Callback callback = new Request.Callback() { 

public void onCompleted(Response response) { 
    FacebookRequestError error = response.getError(); 
                if (error != null) { 
    Log.e("FACEBOOK ERROR", ""+ error.getErrorMessage()); 
      } else { 
                 JSONObject graphResponse = response 
                   .getGraphObject() 
                   .getInnerJSONObject(); 
                 String postId = null; 
                 try { 
                  postId = graphResponse 
                    .getString("id"); 
                 } catch (JSONException e) { 
                 } 
               } 
} 
}; 

Request request = new Request(null,pageid+"/feed",postParams, HttpMethod.POST,callback); 
RequestAsyncTask task = new RequestAsyncTask(request); 
task.execute(); 
+0

예를 들어 ... 탁탁해라. –

관련 문제