Skip to content
This repository has been archived by the owner on Aug 3, 2019. It is now read-only.

Birthday Null #112

Open
Kantesh opened this issue Mar 17, 2014 · 4 comments
Open

Birthday Null #112

Kantesh opened this issue Mar 17, 2014 · 4 comments

Comments

@Kantesh
Copy link

Kantesh commented Mar 17, 2014

Even though i pass permission to get my profile birthday and friends birthday i am getting the field as null.

@AndiosDev2013
Copy link

I am facing same issue. I can get only common info, cannot get additional info which needs additional permission, such as birthday, location, working history and education history info.

@AndiosDev2013
Copy link

This is my source code using android simple facebook, pls check mine, what is wrong on there?

Permission[] permissions = new Permission[] {
Permission.USER_BIRTHDAY,
Permission.USER_WORK_HISTORY
};

@OverRide
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_with_sns);

    mFlag = getIntent().getExtras().getInt(Constants.KEY_FLAG);

    SimpleFacebookConfiguration configuration = new SimpleFacebookConfiguration.Builder()
    .setAppId(getString(R.string.facebook_app_id))
    .setNamespace(getString(R.string.app_name))
    .setPermissions(permissions)
    .setDefaultAudience(SessionDefaultAudience.EVERYONE)
    .setAskForAllPermissionsAtOnce(false)
    .build();

    SimpleFacebook.setConfiguration(configuration);

    mSimpleFacebook = SimpleFacebook.getInstance(this);

    setLogin();
    //setLogout();
}

@OverRide
protected void onResume() {
super.onResume();
mSimpleFacebook = SimpleFacebook.getInstance(this);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    mSimpleFacebook.onActivityResult(this, requestCode, resultCode, data);
}

/**
* Login example.
*/
private void setLogin() {
// Login listener
final OnLoginListener onLoginListener = new OnLoginListener() {

        @Override
        public void onFail(String reason) {
            MessageUtil.showMessage(reason, true);
            LoginWithFacebookActivity.this.finish();
        }

        @Override
        public void onException(Throwable throwable) {
            MessageUtil.showMessage(throwable.getMessage(), true);
            LoginWithFacebookActivity.this.finish();
        }

        @Override
        public void onThinking() {
            // show progress bar or something to the user while login is
            // happening
        }

        @Override
        public void onLogin() {
            // change the state of the button or do whatever you want
            Profile.Properties properties = new Profile.Properties.Builder()
            .add(Profile.Properties.ID)
            .add(Profile.Properties.FIRST_NAME)
            .add(Profile.Properties.LAST_NAME)
            .add(Profile.Properties.BIRTHDAY)
            .add(Profile.Properties.WORK)
            .add(Profile.Properties.AGE_RANGE)
            .add(Profile.Properties.EMAIL)
            .add(Profile.Properties.GENDER)
            .build();
            SimpleFacebook.getInstance().getProfile(properties, new OnProfileListener() {

                @Override
                public void onThinking() {
                }

                @Override
                public void onException(Throwable throwable) {
                    MessageUtil.showMessage(throwable.getMessage(), true);
                    LoginWithFacebookActivity.this.finish();
                }

                @Override
                public void onFail(String reason) {
                    MessageUtil.showMessage(reason, true);
                    LoginWithFacebookActivity.this.finish();
                }

                @Override
                public void onComplete(Profile response) {
                    mProfile = response;
                    HCUser.CheckUserAlreadyRegistered(Constants.LOGIN_TYPE.FACEBOOK, mProfile.getId(), LoginWithFacebookActivity.this);
                }
            });
        }

        @Override
        public void onNotAcceptingPermissions(Permission.Type type) {
        }
    };

    mSimpleFacebook.login(onLoginListener);
}

@eduardonatan
Copy link

Have you solved this? please, i m facing the same issue

@AndiosDev2013
Copy link

Yes, This was from facebook permission issue, in Facebook New version, you should submit request to get more permission such as birthday, Education / Working information etc....

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants