我正在嘗試在Facebook牆上發佈消息而沒有使用Facebook Android SDK打開對話框。我試圖找到一種方式,但找不到。任何人都可以告訴他們如何在沒有打開對話的情況下發布到後臺。在Facebook上顯示的牆上未顯示android上的對話框
我嘗試使用下面的代碼
public static void PublishToFeedInBackground()
{
final Bundle _postParameter = new Bundle();
_postParameter.putString("name", name);
_postParameter.putString("link", link);
_postParameter.putString("picture", link_to_image);
_postParameter.putString("caption", caption);
_postParameter.putString("description", description);
final List<String> PERMISSIONS = Arrays.asList("publish_actions");
if (Session.getActiveSession() != null)
{
// Check for publish permissions
List<String> _permissions = Session.getActiveSession().getPermissions();
if (!isSubsetOf(PERMISSIONS, _permissions))
{
NewPermissionsRequest reauthRequest = new Session.NewPermissionsRequest(this.GetContext(), PERMISSIONS);
Session.getActiveSession().requestNewReadPermissions(reauthRequest);
return;
}
}
this.runOnUiThread(new Runnable()
{
@Override
public void run()
{
Request request = new Request(Session.getActiveSession(), "me/feed", _postParameter, HttpMethod.POST);
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
}
});
}
但職位,而不是* _postParameter *我給我的應用程序頁面的詳細信息。
我還試圖用2種方法,但它並沒有張貼任何
Map<String, Object> params = new HashMap<String, Object>();
params.put("name", name);
params.put("link", link);
params.put("picture", link_to_image);
params.put("caption", caption);
params.put("description", description);
JSONObject jfeed = new JSONObject(params);
final GraphObject _feed = GraphObject.Factory.create(jfeed);
Request.executePostRequestAsync(Session.getActiveSession(), "https://graph.facebook.com/"+userID+"/feed", _feed, new Request.Callback()
{
@Override
public void onCompleted(Response response)
{
Log.i("tag", response.toString());
}
});
第二種方法是
Request.executeRestRequestAsync(Session.getActiveSession(), "stream.publish", _postParameter, HttpMethod.POST);
什麼是您的發佈參數? – 2013-02-26 16:52:53
_postParameters_是一個包含消息,圖片鏈接,頁面鏈接等的包 – glo 2013-02-27 03:54:07
我的意思是,請提供一個示例,說明您在postParameters(包含代碼)中放入的內容以及它實際發佈到牆上的內容。這樣我們可以看,也可以指出任何錯誤。您當前的代碼示例太簡潔,無法真正調試。 – 2013-02-27 05:55:18