antonkrasov / AndroidSocialNetworks

Library for easy work with Facebook, Twitter, LinkedIn and Google on Android
1.04k stars 260 forks source link

No SocialPerson nickname #33

Closed falmanna closed 10 years ago

falmanna commented 10 years ago

Hello, I'm trying to retrieve the socialPerson nickname, but it gives me cannot resolve variable!! I searched the api-demo and it looks it is used in the showprofile fragment, I copied the fragment and the same happened, Cannot resolve variable.

so what's wrong??

gorbin commented 10 years ago

Can you show some code? Hard to make some advises...

falmanna commented 10 years ago

@gorbin This code from the ShowProfileFragment.java , you can find it in the api-demos folder everything works well, except the ( builder.append(socialPerson.nickname); ), it is giving me cannot resolve variable on the nickname property? thank you.

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    ImageView avatarImageView = (ImageView) view.findViewById(R.id.avatar_image_view);
    TextView profileURLTextView = (TextView) view.findViewById(R.id.profile_url_text_view);
    TextView textView = (TextView) view.findViewById(R.id.text_view);

    SocialPerson socialPerson = getArguments().getParcelable(PARAM_SOCIAL_PERSON);

    profileURLTextView.setText(socialPerson.profileURL);

    Picasso.with(getActivity()).load(socialPerson.avatarURL).into(avatarImageView);

    StringBuilder builder = new StringBuilder();
    builder.append("ID: ");
    builder.append(socialPerson.id);
    builder.append('\n');
    builder.append("Name: ");
    builder.append(socialPerson.name);
    builder.append('\n');
    builder.append("Company: ");
    builder.append(socialPerson.company);
    builder.append('\n');
    builder.append("Position: ");
    builder.append(socialPerson.position);
    builder.append('\n');
    builder.append("Nickname: ");
    builder.append(socialPerson.nickname);
    builder.append('\n');
    textView.setText(builder.toString());
}
gorbin commented 10 years ago

Likely, you cant get nickname from this social network - not all social networks send nickname or user didn't set nickname use name insteed

falmanna commented 10 years ago

@gorbin but the developer uses my nickname in his demo, I downloaded the demo from google play, run it, and it worked fine! so why can't I use it?

antonkrasov commented 10 years ago

@abol3z, what social network do you use?

falmanna commented 10 years ago

@antonkrasov Facebook, and I'll use twitter later

antonkrasov commented 10 years ago

@abol3z, not sure that getting nickname will work for Facebook, it was implemented only for Twitter, as only for twitter it has sense...

From Facebook documentation: public_profile Provides access to a person's basic information, including first name, last name, profile picture, gender and age range. This permission is approved by default.

As you see, they don't provide a nickname by default.

falmanna commented 10 years ago

@antonkrasov looks like you didn't understand me, the problem isn't that I am not getting username, it is about the nickname attribute .. it is not existed, see this ... i am using it with twitter now, and the same problem, NO NICKNAME ATTRIBUTE FOR THE SOCIALPERSON OBJECT

screenshot 2014-09-08 16 03 49

antonkrasov commented 10 years ago

@abol3z, check your proguard config, possibly it removes it.

falmanna commented 10 years ago

@antonkrasov well I found it, the problem was with compiling the library, I was compiling this version, compile('com.github.androidsocialnetworks:library:0.3.2@aar') { exclude group: 'com.android.support', module: 'support-v4' transitive = true }

I added this version also and it works compile 'com.github.androidsocialnetworks:library:0.3.7'

thank you :)