Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First define your callback, where you'll get friends and birthday info, if authenticated:</p> <pre><code>Session.StatusCallback statusCallback = new Session.StatusCallback() { // callback when session changes state @Override public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { // Private method, to be defined makeFriendsRequest(); } } }; </code></pre> <p>Then, you can open the session and pass in the necessary, "friends_birthday" permissions request:</p> <pre><code>Session session = new Session(this); session.openForRead(new Session.OpenRequest(this) .setCallback(statusCallback) .setPermissions(Arrays.asList("friends_birthday"))); </code></pre> <p>Finally, here's the post-authentication method you can use to get friends info, including the birthday:</p> <pre><code>private void makeFriendsRequest() { Request myFriendsRequest = Request.newMyFriendsRequest(Session.getActiveSession(), new Request.GraphUserListCallback() { @Override public void onCompleted(List&lt;GraphUser&gt; users, Response response) { if (response.getError() == null) { // Handle response } } }); // Add birthday to the list of info to get. Bundle requestParams = myFriendsRequest.getParameters(); requestParams.putString("fields", "name,birthday"); myFriendsRequest.setParameters(requestParams); myFriendsRequest.executeAsync(); } </code></pre> <p>Also check out the SessionLoginSample app, bundled with the SDK if you're looking for different ways you can implement Facebook Login.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload