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


Java StatusCallback类代码示例

本文整理汇总了Java中com.facebook.Session.StatusCallback的典型用法代码示例。如果您正苦于以下问题:Java StatusCallback类的具体用法?Java StatusCallback怎么用?Java StatusCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: connectFacebook

import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private void connectFacebook()
{
  if ((Session.getActiveSession() != null) && (Session.getActiveSession().isOpened()))
  {
    int i;
    if (!TextUtils.isEmpty(QuizApplication.ˊ.ˋ.゙))
      i = 1;
    else
      i = 0;
    if (i != 0)
    {
      requestFriendPermission(Session.getActiveSession());
      return;
    }
  }
  Session.StatusCallback local2 = new Session.StatusCallback()
  {
    public void call(Session paramAnonymousSession, SessionState paramAnonymousSessionState, Exception paramAnonymousException)
    {
      FacebookFriendsFragment.this.onLoginFacebookCallback(paramAnonymousSession);
    }
  };
  Session.openActiveSession(getActivity(), this, true, local2);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:25,代码来源:FacebookFriendsFragment.java

示例2: requestFriendPermission

import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private void requestFriendPermission(Session paramSession)
{
  Session.NewPermissionsRequest localNewPermissionsRequest = new Session.NewPermissionsRequest(this, Arrays.asList(new String[] { "user_friends" }));
  localNewPermissionsRequest.setCallback(new Session.StatusCallback()
  {
    public void call(Session paramAnonymousSession, SessionState paramAnonymousSessionState, Exception paramAnonymousException)
    {
      if (FacebookFriendsFragment.hasFriendsPermission(paramAnonymousSession.getPermissions()))
      {
        ί localί = ((FriendsTabActivity)FacebookFriendsFragment.this.getActivity()).getErrorDialog();
        localί.ʼ.removeView(localί.ʻ);
        localί.ˊ();
        FacebookFriendsFragment.this.getFriendsFromFacebook(paramAnonymousSession);
      }
    }
  });
  paramSession.requestNewReadPermissions(localNewPermissionsRequest);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:19,代码来源:FacebookFriendsFragment.java

示例3: init

import com.facebook.Session.StatusCallback; //导入依赖的package包/类
public static void init(String appID) {
    Session session;
    if (FB.isLoggedIn()) {
        session = Session.getActiveSession();
        // this shouldn't be an issue for most people: the app id in the session not matching the one provided
        // instead it can probably happen if a developer wants to switch app ids at run time.
        if (appID != session.getApplicationId()) {
            Log.w(FB.TAG, "App Id in active session ("+ session.getApplicationId() +") doesn't match App Id passed in: " + appID);
            session = new Builder(FB.getUnityActivity()).setApplicationId(appID).build();
        }
    } else {
        session = new Builder(FB.getUnityActivity()).setApplicationId(appID).build();
    }
    Session.setActiveSession(session);

    final UnityMessage unityMessage = new UnityMessage("OnInitComplete");
    unityMessage.put("key_hash", FB.getKeyHash());

    // if there is an existing session, reopen it
    if (SessionState.CREATED_TOKEN_LOADED.equals(session.getState())) {
        Session.StatusCallback finalCallback = getFinalCallback(unityMessage, null);
        sessionOpenRequest(session, finalCallback, FB.getUnityActivity(), null, false);
    } else {
        unityMessage.send();
    }
}
 
开发者ID:stevesolomon,项目名称:DualRunner,代码行数:27,代码来源:FBLogin.java

示例4: login

import com.facebook.Session.StatusCallback; //导入依赖的package包/类
public static void login(Activity activity, final SocialCallback callback)
		throws ScoreflexFacebookWrapper.FacebookException {
	if (!isFacebookAvailable(activity))
		throw new ScoreflexFacebookWrapper.FacebookException(
				"Facebook SDK is not available");

	try {
		Session.openActiveSession(activity, true, new Session.StatusCallback() {

			@Override
			public void call(Session session, SessionState state,
					Exception exception) {
				String accessToken = null;
				if (null != session && session.isOpened())
					accessToken = session.getAccessToken();
				callback.call(accessToken, exception);
			}
		});
	} catch (Exception e) {
		throw new FacebookException(e);
	}
}
 
开发者ID:scoreflex,项目名称:scoreflex-android-sdk,代码行数:23,代码来源:ScoreflexFacebookWrapper.java

示例5: showDialogWithoutNotificationBar

import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private static void showDialogWithoutNotificationBar(final Activity activity, 
		final String action, final Bundle params, final SocialShareCallback callback) {
	Session fbSession = Session.openActiveSessionFromCache(activity);
	if (fbSession == null) {
		Session.openActiveSession(activity, true,
				new StatusCallback() {
					@Override
					public void call(Session session, SessionState state,
							Exception exception) {
						if (null != session && session.isOpened()) {
							showDialog(activity, session, action, params, callback);
						}
					}
				});
	} else {
		showDialog(activity, fbSession, action, params, callback);
	}
}
 
开发者ID:scoreflex,项目名称:scoreflex-android-sdk,代码行数:19,代码来源:ScoreflexFacebookWrapper.java

示例6: getOpenRequest

import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private static OpenRequest getOpenRequest(StatusCallback callback, List<String> permissions) {
    OpenRequest req = new OpenRequest(getActivity());
    req.setCallback(callback);
    req.setPermissions(permissions);
    req.setDefaultAudience(SessionDefaultAudience.FRIENDS);

    return req;
}
 
开发者ID:mirhoseini,项目名称:aquaplay,代码行数:9,代码来源:FB.java

示例7: getNewPermissionsRequest

import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private static Session.NewPermissionsRequest getNewPermissionsRequest(Session session, StatusCallback callback, List<String> permissions) {
    Session.NewPermissionsRequest req = new Session.NewPermissionsRequest(getActivity(), permissions);
    req.setCallback(callback);
    // This should really be "req.setCallback(callback);"
    // Unfortunately the current underlying SDK won't add the callback when you do it that way
    // TODO: when upgrading to the latest see if this can be "req.setCallback(callback);"
    // if it still doesn't have it, file a bug!
    session.addCallback(callback);
    req.setDefaultAudience(SessionDefaultAudience.FRIENDS);
    return req;
}
 
开发者ID:mirhoseini,项目名称:aquaplay,代码行数:12,代码来源:FB.java

示例8: onFacebookLinkClick

import com.facebook.Session.StatusCallback; //导入依赖的package包/类
public void onFacebookLinkClick()
{
  if (!ﺩ.ˋ("PREF_IS_FACEBOOK_LINKED"))
  {
    Session.openActiveSession(getActivity(), this, true, new Session.StatusCallback()
    {
      public void call(final Session paramAnonymousSession, SessionState paramAnonymousSessionState, Exception paramAnonymousException)
      {
        if (paramAnonymousSession.isOpened())
          Request.executeMeRequestAsync(paramAnonymousSession, new Request.GraphUserCallback()
          {
            public void onCompleted(GraphUser paramAnonymous2GraphUser, Response paramAnonymous2Response)
            {
              if (paramAnonymous2GraphUser != null)
              {
                SettingsFragment.access$002(SettingsFragment.this, paramAnonymousSession.getAccessToken());
                Object[] arrayOfObject = new Object[1];
                arrayOfObject[0] = SettingsFragment.this.fbAccessToken;
                ךּ.ˊ("REQUEST_FB_LINKING", arrayOfObject);
              }
            }
          });
      }
    });
    return;
  }
  ⅹ localⅹ = QuizApplication.ˊ.ˋ;
  int i;
  if ((localⅹ.ˏ != null) && (!localⅹ.ˏ.equals("")))
    i = 1;
  else
    i = 0;
  if (i != 0)
  {
    ךּ.ˊ("REQUEST_FB_UNLINK", new Object[0]);
    return;
  }
  showUnlinkNotAllowedError();
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:40,代码来源:SettingsFragment.java

示例9: SessionTracker

import com.facebook.Session.StatusCallback; //导入依赖的package包/类
public SessionTracker(Context paramContext, Session.StatusCallback paramStatusCallback, Session paramSession, boolean paramBoolean)
{
  this.callback = new CallbackWrapper(paramStatusCallback);
  this.session = paramSession;
  this.receiver = new ActiveSessionBroadcastReceiver(null);
  this.broadcastManager = con.ˊ(paramContext);
  if (paramBoolean)
    startTracking();
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:10,代码来源:SessionTracker.java

示例10: authorize

import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private void authorize(Activity paramActivity, String[] paramArrayOfString, int paramInt, SessionLoginBehavior paramSessionLoginBehavior, final DialogListener paramDialogListener)
{
  checkUserSession("authorize");
  this.pendingOpeningSession = new Session.Builder(paramActivity).setApplicationId(this.mAppId).setTokenCachingStrategy(getTokenCache()).build();
  this.pendingAuthorizationActivity = paramActivity;
  String[] arrayOfString;
  if (paramArrayOfString != null)
    arrayOfString = paramArrayOfString;
  else
    arrayOfString = new String[0];
  this.pendingAuthorizationPermissions = arrayOfString;
  Session.StatusCallback local1 = new Session.StatusCallback()
  {
    public void call(Session paramAnonymousSession, SessionState paramAnonymousSessionState, Exception paramAnonymousException)
    {
      Facebook.this.onSessionCallback(paramAnonymousSession, paramAnonymousSessionState, paramAnonymousException, paramDialogListener);
    }
  };
  Session.OpenRequest localOpenRequest = new Session.OpenRequest(paramActivity).setCallback(local1).setLoginBehavior(paramSessionLoginBehavior).setRequestCode(paramInt).setPermissions(Arrays.asList(this.pendingAuthorizationPermissions));
  Session localSession = this.pendingOpeningSession;
  boolean bool;
  if (this.pendingAuthorizationPermissions.length > 0)
    bool = true;
  else
    bool = false;
  openSession(localSession, localOpenRequest, bool);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:28,代码来源:Facebook.java

示例11: onActivityCreated

import com.facebook.Session.StatusCallback; //导入依赖的package包/类
public void onActivityCreated(Bundle paramBundle)
{
  super.onActivityCreated(paramBundle);
  this.sessionTracker = new SessionTracker(getActivity(), new Session.StatusCallback()
  {
    public void call(Session paramAnonymousSession, SessionState paramAnonymousSessionState, Exception paramAnonymousException)
    {
      if (!paramAnonymousSession.isOpened())
        PickerFragment.this.clearResults();
    }
  });
  setSettingsFromBundle(paramBundle);
  this.loadingStrategy = createLoadingStrategy();
  this.loadingStrategy.attach(this.adapter);
  this.selectionStrategy = createSelectionStrategy();
  this.selectionStrategy.readSelectionFromBundle(paramBundle, "com.facebook.android.PickerFragment.Selection");
  if (this.showTitleBar)
    inflateTitleBar((ViewGroup)getView());
  if ((this.activityCircle != null) && (paramBundle != null))
  {
    if (paramBundle.getBoolean("com.facebook.android.PickerFragment.ActivityCircleShown", false))
    {
      displayActivityCircle();
      return;
    }
    hideActivityCircle();
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:29,代码来源:PickerFragment.java

示例12: getAfterReadPermissionLoginCallback

import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private static Session.StatusCallback getAfterReadPermissionLoginCallback(final UnityMessage unityMessage, final List<String> publishPermissions, final Activity activity) {
    return new Session.StatusCallback() {
        // callback when session changes state
        @Override
        public void call(Session session, SessionState state, Exception exception) {
            if (session.getState().equals(SessionState.OPENING)){
                return;
            }
            session.removeCallback(this);

            if (!session.isOpened() && state != SessionState.CLOSED_LOGIN_FAILED) {
                unityMessage.sendError("Unknown error while opening session. Check logcat for details.");
                activity.finish();
                return;
            }

            // if someone cancels on the read permissions and we don't even have the most basic access_token
            // for basic info, we shouldn't be asking for publish permissions.  It doesn't make sense
            // and it simply won't work anyways.
            if (session.getAccessToken() == null || session.getAccessToken().equals("")) {
                unityMessage.putCancelled();
                unityMessage.send();
                activity.finish();
                return;
            }

            //ask for publish permissions, if necessary.
            if(session.getPermissions().containsAll(publishPermissions)) {
                finalizeLogin(session, state, exception, unityMessage, activity);
            } else {
                Session.StatusCallback finalCallback = getFinalCallback(unityMessage, activity);
                sessionOpenRequest(session, finalCallback, activity, publishPermissions, true);
            }
        }
    };
}
 
开发者ID:stevesolomon,项目名称:DualRunner,代码行数:37,代码来源:FBLogin.java

示例13: getFinalCallback

import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private static Session.StatusCallback getFinalCallback(final UnityMessage unityMessage, final Activity activityToClose) {
    return new Session.StatusCallback() {
        // callback when session changes state
        @Override
        public void call(Session session, SessionState state, Exception exception) {
            if (session.getState().equals(SessionState.OPENING)){
                return;
            }
            session.removeCallback(this);

            finalizeLogin(session, state, exception, unityMessage, activityToClose);
        }
    };
}
 
开发者ID:stevesolomon,项目名称:DualRunner,代码行数:15,代码来源:FBLogin.java

示例14: getOpenRequest

import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private static OpenRequest getOpenRequest(StatusCallback callback, List<String> permissions, Activity activity) {
    OpenRequest req = new OpenRequest(activity);
    req.setCallback(callback);
    req.setPermissions(permissions);
    req.setDefaultAudience(SessionDefaultAudience.FRIENDS);

    return req;
}
 
开发者ID:stevesolomon,项目名称:DualRunner,代码行数:9,代码来源:FBLogin.java

示例15: getNewPermissionsRequest

import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private static Session.NewPermissionsRequest getNewPermissionsRequest(Session session, StatusCallback callback, List<String> permissions, Activity activity) {
    Session.NewPermissionsRequest req = new Session.NewPermissionsRequest(activity, permissions);
    req.setCallback(callback);
    // This should really be "req.setCallback(callback);"
    // Unfortunately the current underlying SDK won't add the callback when you do it that way
    // TODO: when upgrading to the latest see if this can be "req.setCallback(callback);"
    // if it still doesn't have it, file a bug!
    session.addCallback(callback);
    req.setDefaultAudience(SessionDefaultAudience.FRIENDS);
    return req;
}
 
开发者ID:stevesolomon,项目名称:DualRunner,代码行数:12,代码来源:FBLogin.java


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