Skip to content Skip to sidebar Skip to footer

Get User Email From Facebook Sdk Android

I am just starting out with the Facebook SDK, I currently have an app that has its own login system, the user enters their email and password and then the app checks a mysql databa

Solution 1:

You have two options to get the email of the Facebook user:

Option 1: Use Facebook SDK

  1. Implement Facebook Login with email permission
  2. Get the user data by using Request.newMeRequest(). This is explained here: Personalize

Oprion 2: Use Simple Facebook SDK library

The library: https://github.com/sromku/android-simple-facebook

  1. Set email permission by using Permissions.EMAIL
  2. Then, login

    mSimpleFacebook.login(MainActivity.this);
    
  3. And then, get the profile with the email

    mSimpleFacebook.getProfile(newOnProfileRequestAdapter()
    {
        @OverridepublicvoidonComplete(Profile profile)
        {
            String id = profile.getId();
            String firstName = profile.getFirstName();
            String email = profile.getEmail();
            // ... and many more properties of profile ...
        }
    });
    

Post a Comment for "Get User Email From Facebook Sdk Android"