本文整理汇总了Java中com.facebook.SessionState.isOpened方法的典型用法代码示例。如果您正苦于以下问题:Java SessionState.isOpened方法的具体用法?Java SessionState.isOpened怎么用?Java SessionState.isOpened使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.SessionState
的用法示例。
在下文中一共展示了SessionState.isOpened方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import com.facebook.SessionState; //导入方法依赖的package包/类
@Override
public void call(final Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
final Map<String, String> params = new HashMap<String, String>(3);
params.put(HttpConstants.ACCESS_TOKEN, session.getAccessToken());
//TODO enable field when the permission is accepted
params.put(HttpConstants.FIELDS, HttpConstants.FaceBookConstants.ID + "," +
HttpConstants.FaceBookConstants.NAME + "," +
HttpConstants.FaceBookConstants.BIO + "," +
HttpConstants.FaceBookConstants.ABOUT);
RetroCallback retroCallback;
retroCallback = new RetroCallback(this);
retroCallback.setRequestId(HttpConstants.ApiResponseCodes.GET_FACEBOOK_PROFILE);
retroCallbackList.add(retroCallback);
mProgressBar.setVisibility(View.VISIBLE);
mFacebookApi.getFacebookProfile(params, retroCallback);
}
}
示例2: onSessionStateChange
import com.facebook.SessionState; //导入方法依赖的package包/类
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
Log.i("SplashscreenActivity", "onSessionStateChange");
Controller.getInstance().setSession(session);
if(state.isOpened() && !mConnected){
mConnected = true;
session.refreshPermissions();
List<String> permissions = session.getPermissions();
Log.i("FACEBOOK_CONNECTION", "Logged in..." + permissions.toString());
findViewById(R.id.authButton).setVisibility(View.GONE);
findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
((ProgressWheel) findViewById(R.id.progressBar)).spin();
Server.connect(session.getAccessToken());
} else if(state.isClosed()) {
mConnected = false;
Log.i("FACEBOOK_CONNECTION", "Logged out...");
}
}
示例3: onSessionStateChange
import com.facebook.SessionState; //导入方法依赖的package包/类
private void onSessionStateChange(Session session, SessionState state, Exception exception)
{
if (getView() != null)
{
if (state.isOpened())
{
authButton.setVisibility(View.GONE);
progressBar.setVisibility(View.VISIBLE);
}
else if (state.isClosed())
{
authButton.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
}
}
}
示例4: onSessionStateChange
import com.facebook.SessionState; //导入方法依赖的package包/类
/** Re authenticate after session state changed.*/
public static Promise<Object, BError, Void> onSessionStateChange(Session session, SessionState state, Exception exception) {
if (DEBUG) Timber.i("Session changed state");
// If we can start the login process with no errors this promise wont be used.
// The returned promise will be from the loginWithFacebook.
Deferred<Object, BError, Void> deferred = new DeferredObject<>();
if (exception != null)
{
exception.printStackTrace();
if (exception instanceof FacebookOperationCanceledException)
{
deferred.reject(new BError(BError.Code.EXCEPTION, exception));
return deferred.promise();
}
}
if (state.isOpened()) {
if (DEBUG) Timber.i("Session is open.");
// We will need this session later to make request.
userFacebookAccessToken = Session.getActiveSession().getAccessToken();
return loginWithFacebook();
} else if (state.isClosed()) {
// Logged out of Facebook
if (DEBUG) Timber.i("Session is closed.");
deferred.reject(new BError(BError.Code.SESSION_CLOSED, "Facebook session is closed."));
}
return deferred.promise();
}
示例5: onSessionStateChange
import com.facebook.SessionState; //导入方法依赖的package包/类
public void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
requestUserData(session);
} else if (state.isClosed()) {
mUserHelper.setCurrentUser(null);
if ( mUserSessionCallback != null ) {
mUserSessionCallback.onLogout();
}
}
}
示例6: call
import com.facebook.SessionState; //导入方法依赖的package包/类
@Override
public void call(final Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
Log.d("Facebook token", session.getAccessToken());
Request meRequest = Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
Login login = new Login(user.getProperty("email").toString(), session.getAccessToken(), "facebook");
new CheckUserCredentials(MainActivity.this).execute(login);
session.closeAndClearTokenInformation();
}
});
meRequest.executeAsync();
}
}
示例7: onSessionStateChange
import com.facebook.SessionState; //导入方法依赖的package包/类
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
Log.i(TAG, "Logged in...");
} else if (state.isClosed()) {
Log.i(TAG, "Logged out...");
}
}
示例8: onSessionStateChange
import com.facebook.SessionState; //导入方法依赖的package包/类
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
Log.i(TAG, getString(R.string.fb_logged_in));
} else if (state.isClosed()) {
Log.i(TAG, getString(R.string.fb_logged_out));
}
}
示例9: onSessionStateChange
import com.facebook.SessionState; //导入方法依赖的package包/类
private void onSessionStateChange(Session session, SessionState state,
Exception exception) {
if (state.isOpened()) {
if (callback != null) {
callback.onLogin(session.getAccessToken());
}
logger.debug("Facebook Logged in...");
} else if (state.isClosed()) {
logger.debug("Facebook Logged out...");
} else {
logger.debug("Facebook state changed ...");
}
}
示例10: onSessionStateChange
import com.facebook.SessionState; //导入方法依赖的package包/类
private void onSessionStateChange(Session paramSession, SessionState paramSessionState, Exception paramException)
{
if (paramSessionState.isOpened())
{
if (paramException != null)
Toast.makeText(this, paramException.getMessage(), 0).show();
}
else
paramSessionState.isClosed();
}
示例11: onSessionStateChange
import com.facebook.SessionState; //导入方法依赖的package包/类
private void onSessionStateChange(Session paramSession, SessionState paramSessionState, Exception paramException)
{
if (!paramSessionState.isOpened())
paramSessionState.isClosed();
if (((paramSessionState == SessionState.CLOSED_LOGIN_FAILED) || (paramSessionState == SessionState.CLOSED)) && (!this.mIsWaitingForPlusClient))
hideLoadingLayer();
if (paramException != null)
paramException.printStackTrace();
}
示例12: onSessionStateChange
import com.facebook.SessionState; //导入方法依赖的package包/类
public void onSessionStateChange(Session session, SessionState state,
Exception exception) {
if (state.isOpened()) {
Log.i(TAG, "Logged in");
} else if (state.isClosed()) {
Log.i(TAG, "Logged out");
}
}
示例13: onSessionStateChange
import com.facebook.SessionState; //导入方法依赖的package包/类
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
Log.i(TAG, "Logged in...");
ApplicationData.getInstance().setSession(session);
Intent intent = new Intent(this, FriendsActivity.class);
startActivity(intent);
}
else if (state.isClosed()) {
Log.i(TAG, "Logged out...");
}
}
示例14: onSessionStateChange
import com.facebook.SessionState; //导入方法依赖的package包/类
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
Log.i(TAG, "FB Logged in...");
onLogin(this, session.getAccessToken(), Utils.LoginProvider.FACEBOOK);
} else if (state.isClosed()) {
onLogout(this);
Log.i(TAG, "FB Logged out...");
}
}
示例15: onSessionStateChange
import com.facebook.SessionState; //导入方法依赖的package包/类
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
Log.d("rgai", "FacebookSettingActivity.onSessionStateChange");
Log.d("rgai", "state.isOpened -> " + state.isOpened());
Log.d("rgai", "session.isOpened -> " + session.isOpened());
if (state.isOpened()) {
if (session.isOpened()) {
Log.d("rgai", "STORING FB Session view storehandler");
StoreHandler.storeFacebookAccessToken(FacebookSettingActivity.this, session.getAccessToken(), session.getExpirationDate());
// ErrorLog.dumpLogcat(FacebookSettingActivity.this, ErrorLog.Reason.FB_CONTACT_SYNC, 0, null, "Session is opened after openActiveSession");
Request.newMeRequest(session, new Request.GraphUserCallback() {
public void onCompleted(GraphUser gu, Response rspns) {
Log.d("rgai", "NEW ME REQUEST ON COMPLETE");
if (gu != null) {
Log.d("rgai", "onSessionStateChange gu != null");
if (user == null) {
user = gu;
}
syncFacebookContactList(null);
try {
setFieldsByAccount(gu.getName(), gu.getUsername(), null, gu.getId());
} catch (Exception ex) {
Log.d("rgai", "", ex);
}
} else {
// ErrorLog.dumpLogcat(FacebookSettingActivity.this, ErrorLog.Reason.FB_CONTACT_SYNC, 200, null, "GraphUser IS null, getting friend list");
Log.d("rgai", "GRAPH USER IS NULL");
}
}
}).executeAsync();
}
} else if (state.isClosed()) {
Log.i("rgai", "Logged out...");
}
updateUI();
}