2015-07-10 70 views
1

在Android應用程序中使用ShareLinkContent時,是否有方法將消息添加到ShareDialog中。使用Facebook SDK 4.0。我使用此代碼在Facebook sdk中添加ShareLinkContent的消息?

ShareLinkContent linkContent = new ShareLinkContent.Builder() 

         .setContentTitle("XXXXX") 
         .setContentDescription(
           "XXXXX in real time") 
         .setContentUrl(Uri.parse("http://play.google.com/store/apps/details?id=" + getApplicationContext().getPackageName())) 
         .build(); 



       shareDialog.show(linkContent); 

回答

1

沒有,因爲它應該代表的內容本身(即鏈接)有對ShareLinkContent沒有消息財產,而不是用戶的信息會是什麼。

如果您直接使用圖表API發佈publish_actions權限,則可以將消息附加到ShareApi類。

如果您使用ShareDialog類,則系統會提示用戶輸入消息,而您將無法設置消息。

2

使用:

ShareLinkContent content = new ShareLinkContent.Builder() 
.setContentUrl(yourUrl) 
.build(); 

ShareApi shareApi = new ShareApi(content); 
shareApi.setMessage(message); 
shareApi.share(facebookCallback); 
相關問題