2013-07-12 26 views
9

に(アンドロイドアプリによって投稿された)リンクの画像を変更することはできます私たちはFacebookのは、我々はFacebookの

に(アンドロイドアプリによって投稿された)リンクの画像を変更することができます私は私を通じてフェイスブック上でいくつかのリンクを掲載していますアプリケーションは、私は他の画像は、私のコードは、私はまた、キャプションや説明を見ることができます。この

Intent shareCaptionIntent = new Intent(Intent.ACTION_SEND); 
shareCaptionIntent.setType("image/png"); 
shareCaptionIntent.putExtra(Intent.EXTRA_STREAM, "<URL>"); 
//set caption 
shareCaptionIntent.putExtra(Intent.EXTRA_TEXT, "example caption"); 
shareCaptionIntent.putExtra(Intent.EXTRA_SUBJECT, "example caption"); 
startActivity(Intent.createChooser(shareCaptionIntent,getString(R.string.share))); 

ように書き

Facebookのウォールに表示されたいです。 画像を変更して説明とキャプションを表示するにはどうすればいいですか?添付画像を見つけてくださいenter image description here

答えて

1

いいえあなたはFacebookに投稿した画像のリンクを変更できません。 Facebookはデータをデータベースに保存するときにこのリンクを自動的に生成します。

2

本当に必要な場合は、Android Facebook SDK(投稿されたすべてのものを変更)を使用してこれを行うことができます。 https://developers.facebook.com/docs/howtos/androidsdk/3.0/publish-to-feed/

または

PublishFeedHowToサンプルデモ(L:150-L:154)あなただけの共有を行っている場合 https://github.com/fbsamples/android-3.0-howtos/blob/master/PublishFeedHowTo/src/com/facebook/samples/publishfeedhowto/MainFragment.java

4

、あなたが共有しているリンクは、Facebookから(解析された)LINTEDます共有しているリンク先URLに定義されているメタタグを取得します。あなたの質問への具体的な

<meta property="og:title" content="The Rock" /> 
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" /> 
<meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" /> 
<meta property="og:description" content="A great movie with Sean Connery and Nicolas Cage" /> 

あなたがそれらのメタタグを変更するアクセス権を持っている場合は、あなたがイメージ、タイトルやFacebook上に表示される記事の記述を制御することができます。

参考までに、http://ogp.me/を参照してください。また、Facebookデバッガーhttp://developers.facebook.com/tools/debugを使用して、共有しているURLを補う(解析する)こともできます。

1
 **Using this code you can share any image from your drawable folder** 





    public void share() 
     { 
    Session.openActiveSession(this, true, new Session.StatusCallback() { 

      // callback when session changes state 
      @Override 
      public void call(final Session session, SessionState state, Exception exception) { 

      if (session.isOpened()) { 
       if(!session.getPermissions().contains("publish_actions")) 
         { 
        session.requestNewPublishPermissions(new Session.NewPermissionsRequest(Aboutcampaign.this, PERMISSIONS)); 
         } 
       else 
       { 
       final String message="YOUR STRING MESSAGE"; 
       // make request to the /me API 
       /* Request request = Request 
          .newStatusUpdateRequest(Session.getActiveSession(), message, new Request.Callback() { 
           @Override 
           public void onCompleted(Response response) { 
            showPublishResult(message, response.getGraphObject(), response.getError()); 
           } 
          }); 
        request.executeAsync();*/ 

       Bitmap image = BitmapFactory.decodeResource(Aboutcampaign.this.getResources(), R.drawable.product_btn); 
       // Bitmap BckGrnd = BitmapFactory.decodeFile(file); 
       Request request = Request.newUploadPhotoRequest(Session.getActiveSession(), image, new Request.Callback() { 
        public void onCompleted(Response response) { 
         showPublishResult("Shared on Facebook", response.getGraphObject(), response.getError()); 

        } 
       }); 
       Bundle params = request.getParameters(); 
       // Add the parameters you want, the caption in this case 
       params.putString("name", message); 
       // Update the request parameters 
       request.setParameters(params); 

       // Execute the request 
       Request.executeBatchAsync(request); 
       // request.executeAsync(); 

       } 
      } 
      } 
     });