Java Code Examples for com.facebook.Session#StatusCallback

The following examples show how to use com.facebook.Session#StatusCallback . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SessionTracker.java    From android-skeleton-project with MIT License 5 votes vote down vote up
/**
 * 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();
    }
}
 
Example 2
Source File: SessionTracker.java    From FacebookImageShareIntent with MIT License 5 votes vote down vote up
/**
 * 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();
    }
}
 
Example 3
Source File: SessionTracker.java    From Abelana-Android with Apache License 2.0 5 votes vote down vote up
/**
 * 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();
    }
}
 
Example 4
Source File: SessionTracker.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 5 votes vote down vote up
/**
 * 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();
    }
}
 
Example 5
Source File: LoginButton.java    From KlyphMessenger with MIT License 4 votes vote down vote up
public Session.StatusCallback getSessionStatusCallback() {
    return sessionStatusCallback;
}
 
Example 6
Source File: SessionTracker.java    From platform-friends-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public CallbackWrapper(Session.StatusCallback wrapped) {
    this.wrapped = wrapped;
}
 
Example 7
Source File: SessionTracker.java    From Abelana-Android with Apache License 2.0 4 votes vote down vote up
public CallbackWrapper(Session.StatusCallback wrapped) {
    this.wrapped = wrapped;
}
 
Example 8
Source File: SessionTracker.java    From KlyphMessenger with MIT License 4 votes vote down vote up
public CallbackWrapper(Session.StatusCallback wrapped) {
    this.wrapped = wrapped;
}
 
Example 9
Source File: FragmentSocialTimeline.java    From aptoide-client with GNU General Public License v2.0 4 votes vote down vote up
@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);
    }
}
 
Example 10
Source File: LoginButton.java    From KlyphMessenger with MIT License 4 votes vote down vote up
public void setSessionStatusCallback(Session.StatusCallback callback) {
    this.sessionStatusCallback = callback;
}
 
Example 11
Source File: SessionTracker.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 2 votes vote down vote up
/**
 * Constructs a SessionTracker to track the active Session object.
 * 
 * @param context the context object.
 * @param callback the callback to use whenever the active Session's 
 *                 state changes
 */
public SessionTracker(Context context, Session.StatusCallback callback) {
    this(context, callback, null);
}
 
Example 12
Source File: SessionTracker.java    From android-skeleton-project with MIT License 2 votes vote down vote up
/**
 * 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
 */
SessionTracker(Context context, Session.StatusCallback callback, Session session) {
    this(context, callback, session, true);
}
 
Example 13
Source File: SessionTracker.java    From android-skeleton-project with MIT License 2 votes vote down vote up
/**
 * Constructs a SessionTracker to track the active Session object.
 * 
 * @param context the context object.
 * @param callback the callback to use whenever the active Session's 
 *                 state changes
 */
public SessionTracker(Context context, Session.StatusCallback callback) {
    this(context, callback, null);
}
 
Example 14
Source File: SessionTracker.java    From Abelana-Android with Apache License 2.0 2 votes vote down vote up
/**
 * 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
 */
SessionTracker(Context context, Session.StatusCallback callback, Session session) {
    this(context, callback, session, true);
}
 
Example 15
Source File: LoginButton.java    From Klyph with MIT License 2 votes vote down vote up
/**
 * Sets the callback interface that will be called whenever the status of the Session
 * associated with this LoginButton changes. Note that updates will only be sent to the
 * callback while the LoginButton is actually attached to a window.
 *
 * @param callback the callback interface
 */
public void setSessionStatusCallback(Session.StatusCallback callback) {
    properties.setSessionStatusCallback(callback);
}
 
Example 16
Source File: SessionTracker.java    From Klyph with MIT License 2 votes vote down vote up
/**
 * Constructs a SessionTracker to track the active Session object.
 * 
 * @param context the context object.
 * @param callback the callback to use whenever the active Session's 
 *                 state changes
 */
public SessionTracker(Context context, Session.StatusCallback callback) {
    this(context, callback, null);
}
 
Example 17
Source File: SessionTracker.java    From platform-friends-android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * 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
 */
SessionTracker(Context context, Session.StatusCallback callback, Session session) {
    this(context, callback, session, true);
}
 
Example 18
Source File: SessionTracker.java    From platform-friends-android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Constructs a SessionTracker to track the active Session object.
 * 
 * @param context the context object.
 * @param callback the callback to use whenever the active Session's 
 *                 state changes
 */
public SessionTracker(Context context, Session.StatusCallback callback) {
    this(context, callback, null);
}
 
Example 19
Source File: LoginButton.java    From Klyph with MIT License votes vote down vote up
/**
 * Sets the callback interface that will be called whenever the status of the Session
 * associated with this LoginButton changes.

 * @return the callback interface
 */
public Session.StatusCallback getSessionStatusCallback() {
    return properties.getSessionStatusCallback();
}
 
Example 20
Source File: LoginButton.java    From KlyphMessenger with MIT License votes vote down vote up
/**
 * Sets the callback interface that will be called whenever the status of the Session
 * associated with this LoginButton changes.

 * @return the callback interface
 */
public Session.StatusCallback getSessionStatusCallback() {
    return properties.getSessionStatusCallback();
}