2011-08-16 5 views
1

아래 코드에 몇 가지 문제점이 있습니다. 이 코드는 이메일, 메시지, Twitter (텍스트 전송)에서는 작동하지만 Facebook에서는 작동하지 않습니다. 왜?안드로이드 공유 페이스 북의 의도

Intent i=new Intent(android.content.Intent.ACTION_SEND); 
i.setType("text/plain"); 
i.putExtra(android.content.Intent.EXTRA_SUBJECT,"ScribeAir"); 
i.putExtra(android.content.Intent.EXTRA_TEXT, "ScribeAir has some cool features. Just use it..."); 
startActivity(Intent.createChooser(i,"Share")); 
+1

()가 지금은 이메일을 통해조차 메시지 나 또한 트위터 나 페이스 북을 텍스트를 보낼 수 있습니다 setType 이상 사용하여 http://stackoverflow.com/a/16933944/154272 – Loda

답변

-7

이 시도 :이 페이스 북에서 작동하지 않습니다

i.setType("message/rfc822"); 
+0

를 참조하십시오. – Jyosna

0

페이스 북 ACTION_SEND를 통해 단지 링크를 공유 할 수 있기 때문이다. U가 텍스트뿐만 아니라 링크를 보내려는 경우.

은 첫째로 당신은 지금 페이스 북의 의도를 얻을과 공유 그 때는 활동을 보여주기 위해 대화를 구축 활동 후 대화

Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); 
    sharingIntent.setType("text/plain"); 
    List activities = getPackageManager().queryIntentActivities(sharingIntent,0); 

부일 다음 ACTION_SEND 을 지원하는 설치된 응용 프로그램의 목록을 얻을 수 있습니다 facebook api는 그 자체로 처리되지만 다른 활동에 대한 클래스 이름을 전달하십시오. 오래 전에 오랜 시간이 요구되는 질문에 대한 응답

Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); 
       sharingIntent.setClassName(,); 
       sharingIntent.setType("text/plain"); 
       sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"hello"); 
       sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "facebook"); 
+10

귀하의 게시물에서 아무 것도 이해하지 못했습니다. – Radu

+3

그가 말한 것, 당신이 의도를 통해 직접 faebook과 공유 할 텍스트를 보낼 수 없다는 것이 었습니다. 페이스 북에서 제공하는 API를 사용하여이를 수행해야합니다 ... 그렇게하고 싶다면 다음과 같은 활동을해야합니다. 의도 액션은 페이스 북이 선택되면 이벤트를 보내고 페이스 북을 선택하면 Facebook API를 사용하여 공유해야합니다. –

0
  Intent sharing = new Intent(android.content.Intent.ACTION_SEND); 
      sharing.setClassName(,); 
      sharing.setType("text/plain"); 
      sharing.putExtra(android.content.Intent.EXTRA_SUBJECT,"hello"); 
      sharing.putExtra(android.content.Intent.EXTRA_TEXT, "yahoomail"); 
0

.. 내가 현재로

알고, 페이스 북은 트위터와는 달리 의도을 통해 텍스트의 사전 채우기를 허용하지 않습니다/이메일. Facebook 기본값에 의한 것. 그러나 Facebook SDK 덕분에 우리는 링크 형식으로 텍스트를 공유 할 수 있습니다.

페이스 북 SDK는 sharing Docs