androidsocialauth

Displaying profile details using SocialAuth api


I have a project which I found here. Its social connect api which is common to connect our app with social networking apps. The project works fine. All I need is to display the user profile details in the log cat. I tried the following code which was given in a tutorial here:

private final class ResponseListener implements DialogListener {
    @Override
    public void onComplete(Bundle values) {
        adapter.getUserProfileAsync(new ProfileDataListener());                   

}
private final class ProfileDataListener implements SocialAuthListener<Profile> {

    public void onExecute(Profile t) {

       Log.d("Custom-UI", "Receiving Data");
       Profile profileMap = t;
       Log.d("received profile info",t.toString());

       Log.d("Custom-UI",  "Validate ID         = " + profileMap.getValidatedId());
       Log.d("Custom-UI",  "First Name          = " + profileMap.getFirstName());
       Log.d("Custom-UI",  "Last Name           = " + profileMap.getLastName());

       /* Log.d("Custom-UI",  "Email             = " + profileMap.getEmail());
       Log.d("Custom-UI",  "Country             = " + profileMap.getCountry());
       Log.d("Custom-UI",  "Language            = " + profileMap.getLanguage());
       Log.d("Custom-UI",  "Location            = " + profileMap.getLocation());
       Log.d("Custom-UI",  "Profile Image URL   = " + profileMap.getProfileImageURL());*/

    }

    @Override
    public void onError(SocialAuthError arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onExecute(String arg0, Profile arg1) {
        // TODO Auto-generated method stub

    }

}

The LogCat doesn't print the profile details. Can anyone make changes using the given links?


Solution

  • update your code like this.

    private final class ProfileDataListener implements SocialAuthListener<Profile> {
    
    @Override
    public void onError(SocialAuthError arg0) {
        // TODO Auto-generated method stub
    
    }
    
    @Override
    public void onExecute(String arg0, Profile t) {
    
           Log.d("Custom-UI", "Receiving Data");
           Log.d("Custom-arg0", arg0);
           Profile profileMap = t;
           Log.d("Custom-UI",  "Validate ID         = " + profileMap.getValidatedId());
           Log.d("Custom-UI",  "First Name          = " + profileMap.getFirstName());
           Log.d("Custom-UI",  "Last Name           = " + profileMap.getLastName());
           Log.d("Custom-UI",  "Email               = " + profileMap.getEmail());
           Log.d("Custom-UI",  "Gender                   = " + profileMap.getGender());
           Log.d("Custom-UI",  "Country                  = " + profileMap.getCountry());
           Log.d("Custom-UI",  "Language                 = " + profileMap.getLanguage());
           Log.d("Custom-UI",  "Location                 = " + profileMap.getLocation());
           Log.d("Custom-UI",  "Profile Image URL  = " + profileMap.getProfileImageURL());
    }
    }