カスタム opengraph オブジェクトを使用して Facebook に公開しようとしています。コードを実行してもエラーは発生しませんが、投稿も公開されません。
コードは以下のチュートリアルを参考にしました。 https://developers.facebook.com/docs/android/share-using-the-object-api/
これは私のコードです。
// Check for publish permissions
Log.w("FBShare", "Publish Story not null");
List<String> permissions = session.getPermissions();
if (!isSubsetOf(PERMISSIONS, permissions)) {
pendingPublishReauthorization = true;
Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(
this, PERMISSIONS);
session.requestNewPublishPermissions(newPermissionsRequest);
Log.w("FBShare", "has permission");
return;
}
progressDialog = ProgressDialog.show(this, "", "LOADING..", true);
RequestBatch requestBatch = new RequestBatch();
OpenGraphObject match = OpenGraphObject.Factory
.createForPost("cricdecode:match");
match.setTitle("My match");
match.getData().setProperty("my_team", "Team A");
match.getData().setProperty("opponent", "Team B");
match.getData().setProperty("venue", "some plc");
// Set up the object request callback
Request.Callback objectCallback = new Request.Callback() {
@Override
public void onCompleted(Response response) {
// Log any response error
FacebookRequestError error = response.getError();
if (error != null) {
dismissProgressDialog();
Log.w("FBShare", "error");
}
}
};
Request objectRequest = Request.newPostOpenGraphObjectRequest(
Session.getActiveSession(), match, objectCallback);
objectRequest.setBatchEntryName("objectCreate");
requestBatch.add(objectRequest);
requestBatch.executeAsync();
OpenGraphAction playAction = OpenGraphAction.Factory
.createForPost();
playAction.setProperty("match", "{result=objectCreate:$.id}");
// Set up the action request callback
Request.Callback actionCallback = new Request.Callback() {
@Override
public void onCompleted(Response response) {
dismissProgressDialog();
FacebookRequestError error = response.getError();
if (error != null) {
Toast.makeText(
MainActivity.main_context
.getApplicationContext(),
"Error 1: "+error.getErrorMessage(), Toast.LENGTH_LONG)
.show();
} else {
String actionId = null;
try {
JSONObject graphResponse = response
.getGraphObject().getInnerJSONObject();
actionId = graphResponse.getString("id");
} catch (JSONException e) {
}
Toast.makeText(
MainActivity.main_context
.getApplicationContext(),
actionId, Toast.LENGTH_LONG).show();
}
}
};
// Create the publish action request
Request actionRequest = Request.newPostOpenGraphObjectRequest(
Session.getActiveSession(), match, actionCallback);
// Add the request to the batch
requestBatch.add(actionRequest);