Search in sources :

Example 6 with AccessTokenTracker

use of com.facebook.AccessTokenTracker in project facebook-android-sdk by facebook.

the class UserSettingsFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    accessTokenTracker = new AccessTokenTracker() {

        @Override
        protected void onCurrentAccessTokenChanged(AccessToken oldAccessToken, AccessToken currentAccessToken) {
            fetchUserInfo();
            updateUI();
        }
    };
    callbackManager = CallbackManager.Factory.create();
}
Also used : AccessTokenTracker(com.facebook.AccessTokenTracker) AccessToken(com.facebook.AccessToken)

Example 7 with AccessTokenTracker

use of com.facebook.AccessTokenTracker in project facebook-android-sdk by facebook.

the class ProfileFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);
    callbackManager = CallbackManager.Factory.create();
    profileTracker = new ProfileTracker() {

        @Override
        protected void onCurrentProfileChanged(Profile oldProfile, Profile currentProfile) {
            setProfile(currentProfile);
        }
    };
    accessTokenTracker = new AccessTokenTracker() {

        @Override
        protected void onCurrentAccessTokenChanged(AccessToken oldAccessToken, AccessToken currentAccessToken) {
            // On AccessToken changes fetch the new profile which fires the event on
            // the ProfileTracker if the profile is different
            Profile.fetchProfileForCurrentAccessToken();
        }
    };
    // Ensure that our profile is up to date
    Profile.fetchProfileForCurrentAccessToken();
    setProfile(Profile.getCurrentProfile());
}
Also used : AccessTokenTracker(com.facebook.AccessTokenTracker) ProfileTracker(com.facebook.ProfileTracker) AccessToken(com.facebook.AccessToken) Profile(com.facebook.Profile)

Aggregations

AccessToken (com.facebook.AccessToken)7 AccessTokenTracker (com.facebook.AccessTokenTracker)7 FragmentManager (android.app.FragmentManager)1 FragmentTransaction (android.app.FragmentTransaction)1 FacebookException (com.facebook.FacebookException)1 Profile (com.facebook.Profile)1 ProfileTracker (com.facebook.ProfileTracker)1 LoginResult (com.facebook.login.LoginResult)1 ReactContext (com.facebook.react.bridge.ReactContext)1 WritableMap (com.facebook.react.bridge.WritableMap)1 ThemedReactContext (com.facebook.react.uimanager.ThemedReactContext)1