0

I have used the graph api in android app to get events of facebook page so I added a facebook login button to get access Token from it and I had followed the steps of the tutorial but when I press on the button nothing occur

this is my java code :

callbackManager = CallbackManager.Factory.create();
loginButton = (LoginButton) myView.findViewById(R.id.login_button);
loginButton.setReadPermissions("email");
// If using in a fragment
loginButton.setFragment(this);

// Callback registration
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {

    @Override
    public void onSuccess(LoginResult loginResult) {
    accessToken=loginResult.getAccessToken();//TODO : check
    }

    @Override
    public void onCancel() {

    }

    @Override
    public void onError(FacebookException error) {

    }
});

and this is my xml code:

<com.facebook.login.widget.LoginButton
    android:id="@+id/login_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_marginTop="30dp"
    android:layout_marginBottom="30dp" />

I don't need to have login button in my app is there another way to get access token without using the login button?

M.Khaled
  • 49
  • 1
  • 9

0 Answers0