Collecting Facebook Data with a Boot Share

Asked

Viewed 153 times

0

Good afternoon! I am doing my TCC and need urgent help! Please!

Next... I’m making my app that at the end of the application the user can share, if you want through a shareDialog of the face... until then this quiet... but I wanted that when the user clicked on share... I could collect the data of it such as: name, surname, age, email and location.... Do I necessarily need to log in? my code is below:

    public class CompartilharActivity extends AppCompatActivity {


private ShareDialog shareDialog;
private CallbackManager callbackManager;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_compartilhar);

    callbackManager = CallbackManager.Factory.create();



    shareDialog = new ShareDialog(this);  

}

public void shareLinks(View view) {

    Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.trofeu);
    if (ShareDialog.canShow(ShareLinkContent.class)) {
        ShareLinkContent content = new ShareLinkContent.Builder()
                .setContentTitle("Nome")
                .setContentDescription("Descricao")
                .setContentUrl(Uri.parse("http://site.com"))
                .build();


        shareDialog.show(content);
    }
}

What would be the best solution! Thanks in advance!

1 answer

0

You can only get these types of data if users allow this data to be released. To do this you need to create a APP on facebook by the link: https://developers.facebook.com/apps/ and then create a user permission request.

Take this example by SDK in PHP facebook:

https://developers.facebook.com/docs/php/howto/example_batch_request

This way a permission button is created, where the user needs to accept what their application is asking for. If the user refuses, you have no way to obtain this data.

Here you have a list of permissions you can request:

https://developers.facebook.com/docs/facebook-login/permissions/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.