Facebook friends export Android email address

I am participating in a project that includes integration with facebook. By following http://developers.facebook.com/docs/guides/mobile , I can integrate sdk into my application and it works pretty smoothly.

It looks like a portal where I just need to enter my facebook credentials and it will open facebook content for me in my application screen. We cannot manipulate something here.

What I want is to enter my facebook credentials and get my friends ’email addresses as a list that I can use in my application as I want. For example, showing them in a ListView

Like yahoo.com, which, at the request of the Facebook credentials, saves the csv file to the desktop, on which there is a list of friends addresses. This means that facebook allows you to receive friends email after proper authentication.

I also tried FBRocket. it didn't seem to work ...

How to achieve this programmatically.

+3
source share
4 answers

facebook api, SDK. https://github.com/facebook/facebook-android-sdk. oauth. , Facebook, - API- . , , - , .

package com.greatap;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.facebook.android.*;
import com.facebook.android.Facebook.*;

public class MyGreatActivity extends Activity {

    Facebook facebook = new Facebook("YOUR_APP_ID");

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        facebook.authorize(this, new DialogListener() {
            @Override
            public void onComplete(Bundle values) {}

            @Override
            public void onFacebookError(FacebookError error) {}

            @Override
            public void onError(DialogError e) {}

            @Override
            public void onCancel() {}
        });
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        facebook.authorizeCallback(requestCode, resultCode, data);
    }
}

, /me/friends.

facebook.request("me/friends");

, :

    {
   "data": [
      {
         "name": "Fake",
         "id": "11111"
      },
      {
         "name": "Fake fakerson",
         "id": "111111"
      },
      {
         "name": "So Fake",
         "id": "111111111"
      }
    ]}

, api, , .

fakebook.request("/111111111");

json, . , .

+4
+2

, fakebook.request( "/111111111" ) ID: "111111111", . , Graph API no ( ) . ?field=email , , , , , .

+1

, Facebook

0

Source: https://habr.com/ru/post/1789697/


All Articles