本文整理汇总了Java中com.facebook.Session.StatusCallback方法的典型用法代码示例。如果您正苦于以下问题:Java Session.StatusCallback方法的具体用法?Java Session.StatusCallback怎么用?Java Session.StatusCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.Session
的用法示例。
在下文中一共展示了Session.StatusCallback方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SessionTracker
import com.facebook.Session; //导入方法依赖的package包/类
/**
* Constructs a SessionTracker to track the Session object passed in.
* If the Session is null, then it will track the active Session instead.
*
* @param context the context object.
* @param callback the callback to use whenever the Session's state changes
* @param session the Session object to track
* @param startTracking whether to start tracking the Session right away
*/
public SessionTracker(Context context, Session.StatusCallback callback, Session session, boolean startTracking) {
this.callback = new CallbackWrapper(callback);
this.session = session;
this.receiver = new ActiveSessionBroadcastReceiver();
this.broadcastManager = LocalBroadcastManager.getInstance(context);
if (startTracking) {
startTracking();
}
}
示例2: IUiLifecycleHelperImpl
import com.facebook.Session; //导入方法依赖的package包/类
public IUiLifecycleHelperImpl(Activity activity, Session.StatusCallback statusCallback) {
if (com.facebook.Settings.getApplicationId() != null) {
// make this initialization only if there is an applicationId already configured
uiLifecycleHelper = new UiLifecycleHelper(activity, statusCallback);
}
}
示例3: 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();
}
}
}
示例4: initializeFBSession
import com.facebook.Session; //导入方法依赖的package包/类
private void initializeFBSession() {
lifecycleHelper = new UiLifecycleHelper(this,
new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state,
Exception exception) {
onSessionStateChanged(session, state, exception);
}
});
lifecycleHelper.onCreate(savedInstanceState);
ensureOpenSession();
}
示例5: CallbackWrapper
import com.facebook.Session; //导入方法依赖的package包/类
public CallbackWrapper(Session.StatusCallback wrapped) {
this.wrapped = wrapped;
}
示例6: onCreate
import com.facebook.Session; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
Logger.d("FragmentSocialTimeline", " onCreate");
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
init();
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
fbhelper = new UiLifecycleHelper(getActivity(), new Session.StatusCallback() {
@Override
public void call(final Session session, SessionState state, Exception exception) {
if (!AptoideUtils.AccountUtils.isLoggedIn(Aptoide.getContext()) || removeAccount) {
try {
final AccountManager mAccountManager = AccountManager.get(getActivity());
if (session.isOpened()) {
Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(final GraphUser user, Response response) {
if (removeAccount && mAccountManager.getAccountsByType(Aptoide.getConfiguration().getAccountType()).length > 0) {
mAccountManager.removeAccount(mAccountManager.getAccountsByType(Aptoide.getConfiguration().getAccountType())[0], new AccountManagerCallback<Boolean>() {
@Override
public void run(AccountManagerFuture<Boolean> future) {
startLogin(user, session);
}
}, new Handler(Looper.getMainLooper()));
} else {
startLogin(user, session);
}
}
}).executeAsync();
}
} catch (Exception e) {
Toast.makeText(Aptoide.getContext(), R.string.error_occured, Toast.LENGTH_LONG).show();
loginError();
}
}
}
});
fbhelper.onCreate(savedInstanceState);
}
}
示例7: getSessionStatusCallback
import com.facebook.Session; //导入方法依赖的package包/类
public Session.StatusCallback getSessionStatusCallback() {
return sessionStatusCallback;
}
示例8: getInstance
import com.facebook.Session; //导入方法依赖的package包/类
/**
* Returns instance of {@link org.edx.mobile.module.facebook.IUiLifecycleHelperImpl} class.
* @param activity
* @param statusCallback
* @return
*/
public static IUiLifecycleHelper getInstance(Activity activity, Session.StatusCallback statusCallback) {
return new IUiLifecycleHelperImpl(activity, statusCallback);
}