Search code examples
androidfacebookfacebook-android-sdk

Stuck on White Screen Appears after Facebook login Android


I'm using Facebook SDK to login to facebook account... after trying to sign in white screen appears and stuck on it.. this is my code : ` public class MainActivity extends Activity implements OnClickListener{

Facebook fb;
ImageView pic, button;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Toast.makeText(MainActivity.this, "", Toast.LENGTH_SHORT).show();

    String APP_ID = "151170088390760"; // getString(R.string.APP_ID);
    fb = new Facebook(APP_ID);

    button = (ImageView) findViewById(R.id.login);
    pic = (ImageView) findViewById(R.id.profile_pic);

    button.setOnClickListener(this);
    updateButtonImage();
}

private void updateButtonImage() {
    if(fb.isSessionValid()) {
        button.setImageResource(R.drawable.logout_button);
    }else {
        button.setImageResource(R.drawable.login_button);
    }
}

@Override
public void onClick(View v) {
    if(fb.isSessionValid()) {
        try {
            fb.logout(getApplicationContext());
            updateButtonImage();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    } else {
        // login to facebook
        fb.authorize(MainActivity.this, new DialogListener(){

            @Override
            public void onFacebookError(FacebookError e) {
                Toast.makeText(MainActivity.this, "onFacebookError()", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onError(DialogError e) {
                Toast.makeText(MainActivity.this, "onError()", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onComplete(Bundle values) {
                updateButtonImage();
                Toast.makeText(MainActivity.this, "onComplate()", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onCancel() {
                Toast.makeText(MainActivity.this, "onCancel()", Toast.LENGTH_SHORT).show();
            }
        });
    }
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    fb.authorizeCallback(requestCode, resultCode, data);
}

` I made sure that the Keystore many times and I have registered my application to facebook developers site thank you for helping :) this is the white screen pic:

NOTE: I'm using the Facebook SDK 3.0.1

Problem Has been SOLVED: cuz I tried to login from other facebook account that was not signed as developer

Thank You


Solution

  • the problem was :

    I'm trying to login from facebook account not that I signed as a developer

    Just signing in from the developer account of the app solved the problem.