I am trying to start a test Android app with FB v4 Login and it just won't work. All I get is:
FacebookException: App Not Setup, The developers of this app have not set up this app properly for Facebook Login.
I think I did all the configurations that need to be done but this exceptions tells me I missed something. I registered my app in FB and added added package name, class name, and hash key. In the manifest I added INTERNET permission+ meta-data application id + FacebookActivity.
In my fragment I have LoginButton, CallbackManager and FacebookCallback.
I called callbackManager = CallbackManager.Factory.create() in the onCreate method and called callbackManager.onActivityResult().
LoginButton loginButton;
CallbackManager callbackManager;
FacebookCallback<LoginResult> callback = new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
AccessToken accessToken = loginResult.getAccessToken();
Profile profile = Profile.getCurrentProfile();
Log.d("TEST", "onSuccess: profile - " + profile.getFirstName());
}
@Override
public void onCancel() {
Log.d("TEST", "onCancel");
}
@Override
public void onError(FacebookException e) {
Log.d("TEST", "onError FacebookException: " + e.getMessage());
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
callbackManager = CallbackManager.Factory.create();
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
loginButton = (LoginButton) view.findViewById(R.id.login_button);
loginButton.setReadPermissions("user_friends");
loginButton.setFragment(this);
loginButton.registerCallback(callbackManager, callback);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
callbackManager.onActivityResult(requestCode, resultCode, data);
}
Can anyone see what I have missed?