Can't authorize with Login Button using Facebook app

366 Views Asked by At

I have problem with authorization using Login Button in my Android app.

This is my code:

LoginButton fbButton=(LoginButton)view.findViewById(R.id.fb_button);
List<String> PERMISSIONS = Arrays.asList("publish_actions");
fbButton.setPublishPermissions(PERMISSIONS);
fbButton.setUserInfoChangedCallback(new LoginButton.UserInfoChangedCallback() {
@Override
    public void onUserInfoFetched(GraphUser user) {
        if(user!=null){
            //saving username to SharedPreferences
        }
    }
});
Session session = Session.getActiveSession();
if(session!=null && session.isOpened()) {
    //some actions
}

It works if I haven't installed Facebook app at phone. Then my app shows me webview and I can login. If I have installed Facebook app at phone my app shows dialog and nothing. But if my app is linked with my Facebook account I can login in my app using Facebook app.

0

There are 0 best solutions below