1

I need to integrate a 'share on facebook' button on my app.. following this guide

enter link description here

I add a listener on my button and in the 'onClick' I write:

private static final String FACEBOOK_APPID      = "00000";
private static final String FACEBOOK_PERMISSION = "publish_stream";

    FacebookConnector facebookConnector = new FacebookConnector(FACEBOOK_APPID, activity, context, new String[] { FACEBOOK_PERMISSION });

    facebookConnector.login();

    //facebookConnector.postMessageOnWall("weeee");

I know the APPID number, but…what is the facebook_permission (publish_stream)?

if I try without the facebook_permission I get a null pointer exception

3 Answers3

0

Permission defines, what your app is allowed to do like

  • post on the wall
  • read friend status (or similar)

look here: http://developers.facebook.com/docs/howtos/androidsdk/3.0/fetch-user-data/#step2

you add your permission in your code like

((com.facebook.widget.LoginButton) findViewById(YourLogInId)).setPublishPermissions(Arrays
        .asList("publish_stream"));
longi
  • 11,104
  • 10
  • 55
  • 89
0

Permissions on Facebook basically ask the user what you/your app tries to accomplish. In your example you noticed publish_stream. This allows you to post through your app on the wall of your user. Another frequently used permission is email.

Please take a look at https://developers.facebook.com/docs/reference/login/#permissions and find the permission you want to use :)

Edwin Lambregts
  • 408
  • 6
  • 22
0

Recommendation

Instead of creating a Facebook share button, you should just use a basic Intent using the action ACTION_SEND on the Click of a button.

There reason for this is because if the user does not have Facebook then your application will not work as expected, unless you add some special logic to detect if the Facebook app is installed.

This was the initial reason for ACTION_SEND. Perhaps the user has Twitter instead of facebook, are you saying if the user wants to share on twitter they can't? That seems like an unnecessary restriction.

I would recommend following this approach: How to add Facebook Share button in Android Application

In regards to your problem

A permission is a permission that is defined by the facebook app to access specific data. if you want the user's email, you would request the email permission, if you want to read the feed you need the feed permission. Spend some time and read the documentation:

https://developers.facebook.com/docs/

Community
  • 1
  • 1
JoxTraex
  • 13,423
  • 6
  • 32
  • 45