Java Code Examples for com.facebook.Session#isClosed()

The following examples show how to use com.facebook.Session#isClosed() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FacebookFragment.java    From giraff-android with GNU Affero General Public License v3.0 5 votes vote down vote up
@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();
}
 
Example 2
Source File: LoginFragment.java    From Klyph with MIT License 5 votes vote down vote up
@Override
public void onResume()
{
	super.onResume();

	Session session = Session.getActiveSession();
	if (session != null && (session.isOpened() || session.isClosed()))
	{
		onSessionStateChange(session, session.getState(), null);
	}

	uiHelper.onResume();
}
 
Example 3
Source File: MainActivity.java    From Klyph with MIT License 5 votes vote down vote up
@Override
public void onResume()
{
	Log.d("MainActivity", "onResume");
	super.onResume();

	Session session = Session.getActiveSession();
	if (session != null && (session.isOpened() || session.isClosed()))
	{
		onSessionStateChange(session, session.getState(), null);
		refreshUserPics();
	}
}
 
Example 4
Source File: FacebookShareActivity.java    From FacebookImageShareIntent with MIT License 5 votes vote down vote up
@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();
}
 
Example 5
Source File: LoginFragment.java    From KlyphMessenger with MIT License 5 votes vote down vote up
@Override
public void onResume()
{
	super.onResume();

	Session session = Session.getActiveSession();
	if (session != null && (session.isOpened() || session.isClosed()))
	{
		onSessionStateChange(session, session.getState(), null);
	}

	uiHelper.onResume();
}
 
Example 6
Source File: HypFacebookFrag.java    From HypFacebook with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
*
*
* @public
* @return	void
*/
public void authorize( ){
	trace("authorize");
	Session session = Session.getActiveSession();
       if (!session.isOpened() && !session.isClosed() ) {
           session.openForRead( new Session.OpenRequest(this).setCallback( callback ) );
       } else {
           Session.openActiveSession( getActivity( ), this , true , callback );
       }

}
 
Example 7
Source File: SessionLoginFragment.java    From FacebookNewsfeedSample-Android with Apache License 2.0 5 votes vote down vote up
private void onClickLogin() {
    Session session = Session.getActiveSession();
    if (!session.isOpened() && !session.isClosed()) {
        session.openForRead(new Session.OpenRequest(this).setCallback(statusCallback));
    } else {
        Session.openActiveSession(getActivity(), this, true, statusCallback);
    }
}
 
Example 8
Source File: LoginUsingActivityActivity.java    From FacebookNewsfeedSample-Android with Apache License 2.0 5 votes vote down vote up
private void onClickLogin() {
    Session session = Session.getActiveSession();
    if (!session.isOpened() && !session.isClosed()) {
        session.openForRead(new Session.OpenRequest(this).setCallback(statusCallback));
    } else {
        Session.openActiveSession(this, true, statusCallback);
    }
}
 
Example 9
Source File: LoginFragment.java    From barterli_android with Apache License 2.0 4 votes vote down vote up
@Override
public void onClick(final View v) {

    switch (v.getId()) {

        case R.id.button_facebook_login: {
            GoogleAnalyticsManager
                    .getInstance()
                    .sendEvent(new EventBuilder(Categories.CONVERSION, Actions.SIGN_IN_ATTEMPT)
                                       .set(ParamKeys.TYPE, ParamValues.FACEBOOK));
            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);
            }
            break;
        }

        case R.id.button_google_login: {
            GoogleAnalyticsManager
                    .getInstance()
                    .sendEvent(new EventBuilder(Categories.CONVERSION, Actions.SIGN_IN_ATTEMPT)
                                       .set(ParamKeys.TYPE, ParamValues.GOOGLE));
            ((AuthActivity) getActivity()).getPlusManager().login();
            break;
        }

        case R.id.button_submit: {
            if (isInputValid()) {
                GoogleAnalyticsManager
                        .getInstance()
                        .sendEvent(
                                new EventBuilder(Categories.CONVERSION, Actions.SIGN_IN_ATTEMPT)
                                        .set(ParamKeys.TYPE, ParamValues.EMAIL)
                        );
                login(mEmailEditText.getText().toString(), mPasswordEditText
                        .getText().toString());
            }
            break;
        }

        case R.id.forgot_password: {
            showForgotPasswordDialog();

        }
    }
}
 
Example 10
Source File: SessionLoginFragment.java    From FacebookNewsfeedSample-Android with Apache License 2.0 4 votes vote down vote up
private void onClickLogout() {
    Session session = Session.getActiveSession();
    if (!session.isClosed()) {
        session.closeAndClearTokenInformation();
    }
}
 
Example 11
Source File: LoginUsingActivityActivity.java    From FacebookNewsfeedSample-Android with Apache License 2.0 4 votes vote down vote up
private void onClickLogout() {
    Session session = Session.getActiveSession();
    if (!session.isClosed()) {
        session.closeAndClearTokenInformation();
    }
}