簡體   English   中英

顯式共享不適用於帖子-Facebook Android SDK Open Graph Story

[英]Explicitly Shared not working for post - Facebook Android SDK Open Graph Story

我目前正在使用Facebook Android SDK 3.19.1將Open Graph故事發布到我們用戶的時間軸上。

故事已添加到用戶的活動日志中,但未顯示在他們的時間軸上。

我為故事創建了自定義動作和對象,並為動作和代碼中的相應屬性設置了“顯式共享”選項。 我還提交了“ publish_actions”權限並獲得了批准。

我在這里想念什么嗎?

 private void postGraph(final Bundle b, final Request.Callback callback) {
    // Set up the request callback to handle errors
    Request.Callback errorCallback = new Request.Callback() {

        @Override
        public void onCompleted(Response response) {
            // Log any response error
            FacebookRequestError error = response.getError();
            if (error != null) {
                callback.onCompleted(response);
                Log.i("PostGraph", error.getErrorMessage());
            }
        }
    };

    // Create a batch request
    RequestBatch requestBatch = new RequestBatch();

    // Request: Staging image upload request
    // --------------------------------------------

    boolean hasImage = b.containsKey(BUNDLE_PICTURE);
    // If uploading an image, set up the first batch request
    // to do this.
    if (hasImage) {
        // Set up image upload request parameters
        Bitmap image = BitmapFactory.decodeFile(b.getString(BUNDLE_PICTURE));

        // Create the request for the image upload
        Request imageRequest = Request
                .newUploadStagingResourceWithImageRequest(Session.getActiveSession(),
                        image, errorCallback);

        // Set the batch name so you can refer to the result
        // in the follow-on object creation request
        imageRequest.setBatchEntryName("imageUpload");

        // Add the request to the batch
        requestBatch.add(imageRequest);
    }

    // Request: Object request
    // --------------------------------------------

    // Set up the OpenGraphObject representing the book.
    OpenGraphObject obj = OpenGraphObject.Factory.createForPost(mGraphObjectName);
    if (hasImage) {
        obj.setImageUrls(Arrays.asList("{result=imageUpload:$.uri}"));
    }
    if (b.containsKey(BUNDLE_NAME)) {
        obj.setTitle(b.getString(BUNDLE_NAME));
    }
    if (b.containsKey(BUNDLE_LINK)) {
        obj.setUrl(b.getString(BUNDLE_LINK));
    }
    if (b.containsKey(BUNDLE_MESSAGE)) {
        String message = b.getString(BUNDLE_MESSAGE);
        if (!TextUtils.isEmpty(message)) {
            obj.setDescription(b.getString(BUNDLE_MESSAGE));
            obj.setProperty("message", b.getString(BUNDLE_MESSAGE));
        }
    }

    // Create the request for object creation
    Request objectRequest = Request.newPostOpenGraphObjectRequest(Session.getActiveSession(),
            obj, errorCallback);

    // Set the batch name so you can refer to the result
    // in the follow-on publish action request
    objectRequest.setBatchEntryName("objectCreate");

    // Add the request to the batch
    requestBatch.add(objectRequest);

    // Request: Publish action request
    // --------------------------------------------
    OpenGraphAction postAction = OpenGraphAction.Factory.createForPost(mGraphActionName);
    // Refer to the "id" in the result from the previous batch request
    postAction.setProperty("object", "{result=objectCreate:$.id}");
    postAction.setExplicitlyShared(true);
    postAction.setProperty("explicitly_shared", "true");

    // Create the publish action request
    Request actionRequest = Request.newPostOpenGraphActionRequest(Session.getActiveSession(),
            postAction, callback);

    // Add the request to the batch
    requestBatch.add(actionRequest);

    // Execute the batch request
    requestBatch.executeAsync();
}

我聯系了Facebook的支持團隊,並得到了以下回復:

這是設計使然。 明確表示用戶決定共享故事的事實。 該份額保證顯示在用戶的新聞提要上,而不顯示在他們的時間軸上。

如您所述,它確實顯示在“活動日志”中,然后他們可以通過將選定的選項從“允許在時間軸上”更改為“在時間軸上顯示”來為特定故事選擇下拉菜單。

因此,我的問題畢竟不是問題。 :)

但是,我仍然會認為該功能有些混亂。 我認為在用戶的時間軸上會顯示“明確共享”帖子,並且如果未選中“明確共享”選項,它將具有上述行為。 我想我的問題僅僅是語義。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM