简体   繁体   中英

Permissions en SDK Facebook 3.0

I am using the new SDK Facebook 3.0. I know that when I want to request permissions (no basic), I have to set it in the LoginButton like that:

 signInFBButton.setReadPermissions(Arrays.asList("email"));

But I don't know how to do that when I don't use the LoginButton. I am using openActiveSession() in order to open the session, but I have to take the e-mail and I don´t know how to do that without LoginButton.

Any help?

Thanks.

Create a Session.OpenRequest (it uses the builder pattern).

Session.OpenRequest openRequest = new Session.OpenRequest(this);
openRequest.setPermissions(...)
           .setCallback(...);

then create a new Session and set it as the active session

Session session = new Session(this);
Session.setActiveSession(session);

finally, open the session you just created

session.openForRead(openRequest); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM