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


Java SessionState.isOpened方法代码示例

本文整理汇总了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);
    }

}
 
开发者ID:yeloapp,项目名称:yelo-android,代码行数:23,代码来源:EditProfileFragment.java

示例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...");
	}
}
 
开发者ID:theblindr,项目名称:blindr,代码行数:18,代码来源:SplashscreenActivity.java

示例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);
		}
	}
}
 
开发者ID:jonathangerbaud,项目名称:Klyph,代码行数:17,代码来源:LoginFragment.java

示例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();
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:36,代码来源:BFacebookManager.java

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

示例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();
    }
}
 
开发者ID:Aptoide,项目名称:aptoide-backup-apps,代码行数:16,代码来源:MainActivity.java

示例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...");
    }
}
 
开发者ID:jacquesgiraudel,项目名称:TP-Formation-Android,代码行数:8,代码来源:TestFacebookActivity.java

示例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));
	}
}
 
开发者ID:scintero,项目名称:moveon,代码行数:8,代码来源:History.java

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

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

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

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

示例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...");
    }
}
 
开发者ID:josenaves,项目名称:facebook-friends,代码行数:14,代码来源:LoginActivity.java

示例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...");
	}
}
 
开发者ID:leonardoalt,项目名称:climbers,代码行数:10,代码来源:LoginActivity.java

示例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();
  
    
  }
 
开发者ID:k-kojak,项目名称:yako,代码行数:41,代码来源:FacebookSettingActivity.java


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