A minimalistic guide to Facebook loginsignup implementation

suggest change
  1. You have to setup the prerequisites.
  2. Add the Facebook activity to the AndroidManifest.xml file:
    android:configChanges= "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
    android:label="@string/app_name" />
  1. Add the login button to your layout XML file:
    android:layout_height="wrap_content" />
  1. Now you have the Facebook button. If the user clicks on it, the Facebook login dialog will come up on top of the app’s screen. Here the user can fill in their credentials and press the Log In button. If the credentials are correct, the dialog grants the corresponding permissions and a callback is sent to your original activity containing the button. The following code shows how you can receive that callback:
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
    public void onSuccess(LoginResult loginResult) {
        // Completed without error. You might want to use the retrieved data here.

    public void onCancel() {
        // The user either cancelled the Facebook login process or didn't authorize the app.

    public void onError(FacebookException exception) {
        // The dialog was closed with an error. The exception will help you recognize what exactly went wrong.

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents