Java Code Examples for com.facebook.Profile

The following examples show how to use com.facebook.Profile. These examples are extracted from open source projects. 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 Project: kognitivo   Source File: LoginManager.java    License: Apache License 2.0 5 votes vote down vote up
private void finishLogin(
        AccessToken newToken,
        LoginClient.Request origRequest,
        FacebookException exception,
        boolean isCanceled,
        FacebookCallback<LoginResult>  callback) {
    if (newToken != null) {
        AccessToken.setCurrentAccessToken(newToken);
        Profile.fetchProfileForCurrentAccessToken();
    }

    if (callback != null) {
        LoginResult loginResult = newToken != null
                ? computeLoginResult(origRequest, newToken)
                : null;
        // If there are no granted permissions, the operation is treated as cancel.
        if (isCanceled
                || (loginResult != null
                       && loginResult.getRecentlyGrantedPermissions().size() == 0)) {
            callback.onCancel();
        } else if (exception != null) {
            callback.onError(exception);
        } else if (newToken != null) {
            callback.onSuccess(loginResult);
        }
    }
}
 
Example 2
Source Project: AndroidBlueprints   Source File: FacebookHelper.java    License: Apache License 2.0 5 votes vote down vote up
private void initProfileTracker() {
    mProfileTracker = new ProfileTracker() {
        @Override
        protected void onCurrentProfileChanged(Profile oldProfile, Profile currentProfile) {
            //                Toast.makeText(mActivity, "Facebook current profile changed", Toast.LENGTH_SHORT)
            //                        .show();
        }
    };
}
 
Example 3
Source Project: kute   Source File: RegisterActivity.java    License: Apache License 2.0 5 votes vote down vote up
public void saveFacebookProfile(Profile pf)
{
    SharedPreferences pref=getApplicationContext().getSharedPreferences("user_credentials",0);
    SharedPreferences.Editor editor=pref.edit();
    editor.putString("Login_Method","Facebook");
    editor.putString("Name", pf.getName());
    editor.putString("Id",pf.getId());
    editor.putString("Profile_Image","null");
    editor.putBoolean("Register_db",true);
    editor.putBoolean("Sync_Friends_db",true);
    editor.apply();
}
 
Example 4
Source Project: kognitivo   Source File: LoginManager.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Logs out the user.
 */
public void logOut() {
    AccessToken.setCurrentAccessToken(null);
    Profile.setCurrentProfile(null);
}