當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。