本文整理汇总了Java中com.facebook.Session.isClosed方法的典型用法代码示例。如果您正苦于以下问题:Java Session.isClosed方法的具体用法?Java Session.isClosed怎么用?Java Session.isClosed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.Session
的用法示例。
在下文中一共展示了Session.isClosed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fetchProfileInfoFromFacebook
import com.facebook.Session; //导入方法依赖的package包/类
/**
* Fetch profile information from Facebook
*/
private void fetchProfileInfoFromFacebook() {
mWasProfileImageUploaded = false;
final Session session = Session.getActiveSession();
if (!session.isOpened() && !session.isClosed()) {
session.openForRead(new Session.OpenRequest(this)
.setPermissions(Arrays
.asList(AppConstants
.FBPERMISSIONS))
.setCallback(this));
} else {
Session.openActiveSession(getActivity(), this, true, this);
}
}
示例2: connect
import com.facebook.Session; //导入方法依赖的package包/类
@Override
public void connect(Activity activity)
{
Session session = Session.getActiveSession();
// TODO: I think we should validate the session here, but to what
// extent?
MadFacebookStatusCallback statusCallback =
new MadFacebookStatusCallback();
// Check if the session is already open.
if (!session.isOpened() && !session.isClosed())
{
OpenRequest openRequest = new OpenRequest(activity);
session.openForRead(openRequest
.setCallback(statusCallback));
}
else
{
Session.openActiveSession(activity, true,
statusCallback);
}
}
示例3: onSessionStateChange
import com.facebook.Session; //导入方法依赖的package包/类
@Override
protected void onSessionStateChange(Session session, SessionState state, Exception exception){
final TextView txtUserDetails = (TextView) mCurrentView.findViewById(R.id.mapViewLoggedInUser);
if (session != null && session.isOpened()) {
Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user,
Response response) {
if (user != null) {
txtUserDetails.setText("Logged in as " + user.getName());
System.out.println("onSessionStateChange: LoadNotes: session is open. username:"+user.getName());
}
}
});
Request.executeBatchAsync(request);
} else if (session.isClosed()) {
txtUserDetails.setText("");
System.out.println("onSessionStateChange: LoadNotes: session was closed.");
}
}
示例4: onSessionStateChangeP
import com.facebook.Session; //导入方法依赖的package包/类
private void onSessionStateChangeP(Session session, SessionState state, Exception exception)
{
if (session != null && session.isOpened()) {
Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user,
Response response) {
if (user != null) {
LoggedInUser = user;
}
}
});
Request.executeBatchAsync(request);
} else if (session.isClosed()) {
LoggedInUser = null;
}
onSessionStateChange(session, state, exception);
}
示例5: populateLoggedInUser
import com.facebook.Session; //导入方法依赖的package包/类
private void populateLoggedInUser() {
final TextView txtUserDetails = (TextView) this.getActivity().findViewById(R.id.userDetails);
final Session session = Session.getActiveSession();
if (session != null && session.isOpened()) {
// If the session is open, make an API call to get user data
// and define a new callback to handle the response
Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
// If the response is successful
if (session == Session.getActiveSession()) {
if (user != null) {
String user_ID = user.getId();//user id
String profileName = user.getName();//user's profile name
txtUserDetails.setText(user.getName());
}
}
}
});
Request.executeBatchAsync(request);
} else if (session == null || session.isClosed()) {
}
}
示例6: onResume
import com.facebook.Session; //导入方法依赖的package包/类
public void onResume() {
Session session = Session.getActiveSession();
if (session != null &&
(session.isOpened() || session.isClosed()) ) {
onSessionStateChange(session, session.getState(), null);
}
mUiHelper.onResume();
}
示例7: onClickLogin
import com.facebook.Session; //导入方法依赖的package包/类
public void onClickLogin() {
Session session = Session.getActiveSession();
if (!session.isOpened() && !session.isClosed()) {
Session.OpenRequest openRequest = new Session.OpenRequest(mContext);
openRequest.setPermissions(this.mPermissions);
openRequest.setCallback(this);
session.openForRead(openRequest);
} else {
Session.openActiveSession(mContext, true, this);
}
}
示例8: onResume
import com.facebook.Session; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
Session session = Session.getActiveSession();
if (session != null && (session.isClosed() || session.isOpened())) {
onSessionChange(session, session.getState(), null);
}
uiHelper.onResume();
}
示例9: onResume
import com.facebook.Session; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
Log.i("SplashscreenActivity", "onResume");
Session session = Session.getActiveSession();
if (session != null &&
(session.isOpened() || session.isClosed()) ) {
onSessionStateChange(session, session.getState(), null);
}
uiHelper.onResume();
}
示例10: onResume
import com.facebook.Session; //导入方法依赖的package包/类
@Override
public void onResume() {
super.onResume();
// For scenarios where the main activity is launched and user
// session is not null, the session state change notification
// may not be triggered. Trigger it if it's open/closed.
Session session = Session.getActiveSession();
if (session != null &&
(session.isOpened() || session.isClosed()) ) {
onSessionStateChange(session, session.getState(), null);
}
uiHelper.onResume();
}
示例11: onClickLogin
import com.facebook.Session; //导入方法依赖的package包/类
private void onClickLogin() {
Session session = Session.getActiveSession();
if (!session.isOpened() && !session.isClosed()) {
session.openForRead(new Session.OpenRequest(this).setPermissions(
Arrays.asList("email","user_birthday")).setCallback(this));
} else {
Session.openActiveSession(this, true, this);
}
}
示例12: login
import com.facebook.Session; //导入方法依赖的package包/类
@Override
public void login() {
Session session = Session.getActiveSession();
if ( activity == null )
return;
if (session != null && !session.isOpened() && !session.isClosed()) {
session.openForRead(new Session.OpenRequest(activity)
.setPermissions(Arrays.asList("public_profile", "email"))
.setCallback(statusCallback));
} else {
Session.openActiveSession(activity, true, Arrays.asList("public_profile", "email"), statusCallback);
}
}
示例13: onActivityResumed
import com.facebook.Session; //导入方法依赖的package包/类
@Override
public void onActivityResumed(Activity activity) {
super.onActivityResumed(activity);
// For scenarios where the main activity is launched and user
// session is not null, the session state change notification
// may not be triggered. Trigger it if it's open/closed.
Session session = Session.getActiveSession();
if (session != null && (session.isOpened() || session.isClosed())) {
onSessionStateChange(session, session.getState(), null);
}
uiHelper.onResume();
}
示例14: onResume
import com.facebook.Session; //导入方法依赖的package包/类
@Override
public void onResume() {
super.onResume();
Session session = Session.getActiveSession();
if (session != null &&
(session.isOpened() || session.isClosed()) ) {
onSessionStateChangeP(session, session.getState(), null);
}
uiHelper.onResume();
}
示例15: onClickLogout
import com.facebook.Session; //导入方法依赖的package包/类
private void onClickLogout() {
Session session = Session.getActiveSession();
if (!session.isClosed()) {
session.closeAndClearTokenInformation();
}
}