6

Hey I'm trying to use two different type of permissions.

When I'm using only one, all works fine.

But when I'm using both of them the app crashes:

LoginButton authButton = (LoginButton) view.findViewById(R.id.authButton);
authButton.setReadPermissions(Arrays.asList("friends_games_activity"));
authButton.setPublishPermissions(Arrays.asList("publish_actions"));

How can I add the 2 permissions (friends_games_activity and publish_actions) without problems?

Aviram Fireberger
  • 3,910
  • 5
  • 50
  • 69

1 Answers1

10

You cannot have both permissions in SDK 3.0, you need separate them. You can first open session for read, get what you want and then openForPublish.

Note: In the new SDK, you may ask only for read permissions when you first open a session. You should not prompt your user for publish permissions until the time at which they are actually publishing an action to Facebook. This increases user trust, and also the likelihood that your user will choose to publish stories from your app. To request further permissions, use Session.openForRead or Session.openForPublish.

You need to call clearPermissions. It's described here http://developers.facebook.com/docs/reference/android/3.0/LoginButton/#setReadPermissions(List)

M G
  • 1,240
  • 14
  • 26
  • thank you, but how can I clear the permission or re-setup the new one? I set them on the Button "authButton " not the session can I do:? authButton.clearPermissions(); authButton.setPublishPermissions(Arrays.asList("publish_actions")); – Aviram Fireberger Mar 31 '13 at 12:56
  • 1.authButton.setReadPermissions(Arrays.asList("friends_games_activity")); 2. when press button you get read permissions 3. clearPermissions(); 4. authButton.setPublishPermissions(Arrays.asList("publish_actions")); 5. when press you get write permissions – M G Mar 31 '13 at 21:36
  • ok. but the authButton is the LogIn to facebook button and I would like that when I press for example. Send Score button the permission will be fliiped – Aviram Fireberger Apr 03 '13 at 07:09
  • 1
    Yes, permissions will be flipped. When user is logged in, you dont need read permissions. – M G Apr 03 '13 at 13:29
  • 1
    i have same problem but fbloginbtn not adding the publish_actions so please tell me how can i achieve @Marcin Gawel – Ashok Feb 03 '15 at 05:53