こんにちは、FacebookのボタンのようなAndroidアプリで使用しようとしています。
Facebookが提供するコードをここで探しました:
https://developers.facebook.com/docs/reference/opengraph/action-type/og.likes
そしてここ:
https://developers.facebook.com/docs/opengraph/guides/og.likes/#publishing
このタイプを追加しました:
これは私のアンドロイドコードです:
class LikeTigoFacebook extends AsyncTask<String, Void, Void> {
protected Void doInBackground(String... args) {
Settings.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);
Bundle params = new Bundle();
params.putString("object",
"https://www.facebook.com/pages/Tigo/535949156477655");
Request request = new Request(Session.getActiveSession(),
"me/og.likes", params, HttpMethod.POST);
Response response = request.executeAndWait();
Log.i("check", response.getError().getErrorMessage());
Log.i("check2", response.toString());
return null;
}
/**
* After completing background task Dismiss the progress dialog
* **/
protected void onPostExecute(Void file_url) {
}
}
そして、私はこのエラーコードを取得します:
(#100) Like actions are not yet supported against objects of this type.
応答からの完全な文字列は次のとおりです。
{Response: responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 100, errorType: OAuthException, errorMessage: (#100) Like actions are not yet supported against objects of this type.}, isFromCache:false}
私のセッションが開かれ、ユーザーがログインしたときにこの権限を追加しました:
private void onClickLogin() {
Session currentSession = Session.getActiveSession();
if (currentSession == null || currentSession.getState().isClosed()) {
Session session = new Session.Builder(RegisterPage.this).build();
Session.setActiveSession(session);
currentSession = session;
}
if (currentSession.isOpened()) {
// Do whatever u want. User has logged in
} else if (!currentSession.isOpened()) {
// Ask for username and password
OpenRequest op = new Session.OpenRequest(
(Activity) RegisterPage.this);
op.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO);
op.setCallback(null);
List<String> permissions = new ArrayList<String>();
permissions.add("email");
permissions.add("publish_actions");
op.setPermissions(permissions);
Session session = new Session.Builder(RegisterPage.this).build();
Session.setActiveSession(session);
session.openForPublish(op);
}
}
私はここを見てみました:
組み込みの like アクションはオブジェクト タイプを拒否します
古い答えのように思えます。
助けてくれてありがとう