当前位置: 首页>>代码示例>>Java>>正文


Java Session.isOpened方法代码示例

本文整理汇总了Java中com.facebook.Session.isOpened方法的典型用法代码示例。如果您正苦于以下问题:Java Session.isOpened方法的具体用法?Java Session.isOpened怎么用?Java Session.isOpened使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.Session的用法示例。


在下文中一共展示了Session.isOpened方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openSession

import com.facebook.Session; //导入方法依赖的package包/类
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:23,代码来源:FacebookFragment.java

示例2: 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);
}
 
开发者ID:ZanyGnu,项目名称:GeoNote,代码行数:20,代码来源:BaseFacebookHandlerFragment.java

示例3: fetchUserInfo

import com.facebook.Session; //导入方法依赖的package包/类
private void fetchUserInfo() {
    final Session currentSession = getSession();
    if (currentSession != null && currentSession.isOpened()) {
        if (currentSession != userInfoSession) {
            Request request = Request.newMeRequest(currentSession, new Request.GraphUserCallback() {
                @Override
                public void onCompleted(GraphUser me, Response response) {
                    if (currentSession == getSession()) {
                        user = me;
                        updateUI();
                    }
                    if (response.getError() != null) {
                        loginButton.handleError(response.getError().getException());
                    }
                }
            });
            Bundle parameters = new Bundle();
            parameters.putString(FIELDS, REQUEST_FIELDS);
            request.setParameters(parameters);
            Request.executeBatchAsync(request);
            userInfoSession = currentSession;
        }
    } else {
        user = null;
    }
}
 
开发者ID:yeloapp,项目名称:yelo-android,代码行数:27,代码来源:UserSettingsFragment.java

示例4: 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()) {

            }
        }
 
开发者ID:ZanyGnu,项目名称:GeoNote,代码行数:27,代码来源:LoginActivityFB.java

示例5: onSessionStateChange

import com.facebook.Session; //导入方法依赖的package包/类
protected void onSessionStateChange(Session session, SessionState state, Exception exception){
    if (session != null && session.isOpened()) {
        logAndShowOnScreen("\nLogged in. Getting user details.");
        Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
            @Override
            public void onCompleted(GraphUser user,
                                    Response response) {
                if (user != null) {
                    System.out.println("onSessionStateChange: LoadNotes: session is open. username:"+user.getName());

                    loadNotes(getActivity(), user.getId());
                }
            }
        });
        Request.executeBatchAsync(request);
    } else {
        logAndShowOnScreen("\nUser not already logged in.");
        System.out.println("onSessionStateChange: LoadNotes: session was closed.");
        loadNotes(getActivity(), getLoggedInUsername());
    }
}
 
开发者ID:ZanyGnu,项目名称:GeoNote,代码行数:22,代码来源:SplashScreenFragment.java

示例6: updateView

import com.facebook.Session; //导入方法依赖的package包/类
private void updateView() {
	Session session = Session.getActiveSession();
	if (session.isOpened()) {
		makeMeRequest();
		// textInstructionsOrLink.setText(URL_PREFIX_FRIENDS +
		// session.getAccessToken());

		// buttonLoginLogout.setText("Logout");
		// buttonLoginLogout.setOnClickListener(new OnClickListener() {
		// public void onClick(View view) { onClickLogout(); }
		// });
	} else {
		onClickLogin();
		// textInstructionsOrLink.setText("Please login");
		// buttonLoginLogout.setText("Login");
		// buttonLoginLogout.setOnClickListener(new OnClickListener() {
		// public void onClick(View view) { onClickLogin(); }
		// });
	}
	
}
 
开发者ID:ohmp,项目名称:UniversalSocialLoginAndroid,代码行数:22,代码来源:FacebookLoginActivity.java

示例7: 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);
	}

}
 
开发者ID:netanelkl,项目名称:guitar_guy,代码行数:26,代码来源:FacebookProfileConnector.java

示例8: getOpenSession

import com.facebook.Session; //导入方法依赖的package包/类
/**
 * Returns the current Session that's being tracked if it's open, 
 * otherwise returns null.
 * 
 * @return the current Session if it's open, otherwise returns null
 */
public Session getOpenSession() {
    Session openSession = getSession();
    if (openSession != null && openSession.isOpened()) {
        return openSession;
    }
    return null;
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:14,代码来源:SessionTracker.java

示例9: loginError

import com.facebook.Session; //导入方法依赖的package包/类
public void loginError() {
    Session session = Session.getActiveSession();

    if (session != null && session.isOpened()) {
        session.closeAndClearTokenInformation();
    }
    loginMode = false;
    init();
}
 
开发者ID:Aptoide,项目名称:aptoide-client,代码行数:10,代码来源:FragmentSocialTimeline.java

示例10: 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();
}
 
开发者ID:alessandrogurgel,项目名称:pedefacil,代码行数:9,代码来源:FbLoginDelegate.java

示例11: 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);
    }
}
 
开发者ID:alessandrogurgel,项目名称:pedefacil,代码行数:12,代码来源:FbLoginDelegate.java

示例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);
    }
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:14,代码来源:FacebookAuth.java

示例13: onActivityCreated

import com.facebook.Session; //导入方法依赖的package包/类
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    sessionTracker = new SessionTracker(getActivity(), new Session.StatusCallback() {
        @Override
        public void call(Session session, SessionState state, Exception exception) {
            if (!session.isOpened()) {
                // When a session is closed, we want to clear out our data so it is not visible to subsequent users
                clearResults();
            }
        }
    });

    setSettingsFromBundle(savedInstanceState);

    loadingStrategy = createLoadingStrategy();
    loadingStrategy.attach(adapter);

    selectionStrategy = createSelectionStrategy();
    selectionStrategy.readSelectionFromBundle(savedInstanceState, SELECTION_BUNDLE_KEY);

    // Should we display a title bar? (We need to do this after we've retrieved our bundle settings.)
    if (showTitleBar) {
        inflateTitleBar((ViewGroup) getView());
    }

    if (activityCircle != null && savedInstanceState != null) {
        boolean shown = savedInstanceState.getBoolean(ACTIVITY_CIRCLE_SHOW_KEY, false);
        if (shown) {
            displayActivityCircle();
        } else {
            // Should be hidden already, but just to be sure.
            hideActivityCircle();
        }
    }
}
 
开发者ID:ButterFlyDevs,项目名称:BrainStudio,代码行数:38,代码来源:PickerFragment.java

示例14: onSessionChange

import com.facebook.Session; //导入方法依赖的package包/类
public void onSessionChange (Session session, SessionState sessionState, Exception e) {
    if (session != null && session.isOpened()) {
        // Está logueado
    } else {
        config.clear();
        Intent intent = new Intent(Logout.this, LoginStep1.class);
        startActivity(intent);
    }
}
 
开发者ID:dannegm,项目名称:BrillaMXAndroid,代码行数:10,代码来源:Logout.java

示例15: 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();
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:14,代码来源:FacebookAuth.java


注:本文中的com.facebook.Session.isOpened方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。