I read the docs a lot from Facebook, but I don't see something which helps me to get the email
or the id
.
I searched also in Google but there was nothing helpful.
I have an app to log in and log out, but I need to use the email and the id!
I read the docs a lot from Facebook, but I don't see something which helps me to get the email
or the id
.
I searched also in Google but there was nothing helpful.
I have an app to log in and log out, but I need to use the email and the id!
To get these information you need to log in using Facebook info, right? OK. Facebook supports you giving you the code to log in. The only person that can give you permission is the user.
Once the user gives you permission to access his info, you can get his email and facebook id very easily.
1 Step -> How to log in in Android apps: https://developers.facebook.com/docs/android/login-with-facebook/v2.1
2 Step -> Permission : https://developers.facebook.com/docs/android/login-with-facebook/v2.1#step3 2.1 "Here's an example that asks for email..."
3- Facebook SDK for Android : https://developers.facebook.com/docs/android/getting-started/
Once you do everything above(It is easier than you think), if I am not wrong(you have to check the right code), you can get userEmail, and userID using a code similar to this:
if (user != null) {
TextView welcome = (TextView) findViewById(R.id.welcome);
welcome.setText("Hello " + user.getName() + "!");
I am sure it is not this way I am doing here, but you can get the email and id easily like this code in here. It is just an example:
email = user.email;
user_ID = user.getId();
This question can help you as well.
I hope it can help you.