2013-07-12 39 views
9

我們能在Facebook上我們可以改變鏈接的圖像(這是由Android應用程序發佈)在Facebook上

我張貼,通過在Facebook上的一些鏈接,更改鏈接的圖像(這是由Android應用程序發佈)我應用程序,但我想在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))); 

我可以看到標題和描述也。 我如何更改圖像並使其描述和標題可見,請找到附加圖像enter image description here

回答

1

不,您可以更改您在Facebook上發佈的圖像的鏈接。當它將數據存儲在數據庫中時,它自己生成這個鏈接。

4

如果你只是在做一個份額,那你是Facebook的分享得到LINTED(分析)鏈接並抓取您正在共享的目標網址上定義的元標記。

具體到你的問題:

<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" /> 

如果你有機會改變那些meta標籤,那麼你就可以控制圖像,標題和顯示在Facebook上的帖子描述。

僅供參考,請參閱http://ogp.me/以及使用Facebook調試器http://developers.facebook.com/tools/debug來lint(解析)您共享的網址。

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(); 

       } 
      } 
      } 
     }); 
相關問題