0

I tried integrating login with facebook in android with calling registerCallBack from Facebook LoginButton and it worked perfectly. But I wanted to customize my facebook login button with an ImageButton, so I tried performClick() when clicking on my customized ImageButton as below

callbackManager = CallbackManager.Factory.create();
LoginButton btnSignInFacebook = findViewById(R.id.btn_social_sync_facebook);
List<String> permissionNeeds = Arrays.asList("user_photos", "email",
            "user_birthday", "public_profile", "AccessToken");
    btnSignInFacebook.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
        @Override
        public void onSuccess(LoginResult loginResult) {
            GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(),
                    new GraphRequest.GraphJSONObjectCallback() {
                        @Override
                        public void onCompleted(JSONObject object, GraphResponse response) {
                            startActivity(new Intent(SocialAccountsSyncActivity.this, AccountInformationSignUpActivity.class));
                        }
                    });
            Bundle parameters = new Bundle();
            parameters.putString("fields",
                    "id,name,email,gender, birthday");
            request.setParameters(parameters);
            request.executeAsync();
        }

        @Override
        public void onCancel() {

        }

        @Override
        public void onError(FacebookException error) {

        }
    });
}
@Override
public void onClick(View view) {
    switch (view.getId()) {
        //my customized imagebutton
        case R.id.ib_social_sync_facebook:
            btnSignInFacebook.performClick();
            break;
    }
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    callbackManager.onActivityResult(requestCode, resultCode, data);
}

This kept giving me this error:

Unsupported get request. Object with ID '668803530142270' does not exist, cannot be loaded due to missing permissions, or does not support this operation.

Anyone knows the reason please help me with it. Thanks

Rahul Chokshi
  • 670
  • 4
  • 18
Tedxxxx
  • 238
  • 3
  • 19
  • see this one https://stackoverflow.com/a/50372280/9408181 – Rahul Chokshi Sep 01 '18 at 05:11
  • I checked it. It said I need to submit my app for review, but i don't know why my facebook login still worked when I registerCallBack directly from fb loginButton. – Tedxxxx Sep 01 '18 at 05:23

0 Answers0