I have the below method: 

public String tryGoogleAuthentication(String auth_token){
    ContactsService contactsService = new ContactsService(".....");
    contactsService.setUserToken(auth_token);

    IFeed feed = null;
    try {
        feed = contactsService.getFeed(new 
URL("https://www.google.com/m8/feeds/  
contacts/default/full?max-results=10000"), ContactFeed.class);
    } catch (IOException e) {
        e.printStackTrace();
        return CONST.GOOGLE_AUTH_INVALID_TOKEN;
    } catch (ServiceException e) {          
        e.printStackTrace();
        return CONST.GOOGLE_AUTH_INVALID_TOKEN;
    } catch (NullPointerException e) {
        e.printStackTrace();
        return CONST.GOOGLE_AUTH_INVALID_TOKEN;
    }

    if (feed == null)
        return "";

    String externalId = feed.getId();
    IPerson person = feed.getAuthors().get(0);
    String email = person.getEmail();
    String name = person.getName();
    String nameLang = person.getNameLang();

    System.out.println("externalId: " + externalId);
    System.out.println("email: " + email);
    System.out.println("name: " + name);
    System.out.println("nameLang: " + nameLang);

    return CONST.STATUS_OK;
}

and I get the error:

java.lang.NullPointerException: No authentication header information
at 
com.google.gdata.util.AuthenticationException.initFromAuthHeader(AuthenticationException.java:96)
at 
com.google.gdata.util.AuthenticationException.<init>(AuthenticationException.java:67)
at 
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:600)
at 
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563)
at 
com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:552)
at 
com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:530)
at 
com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535)
at com.google.gdata.client.Service.getFeed(Service.java:1135)
at com.google.gdata.client.Service.getFeed(Service.java:998)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:631)
at com.google.gdata.client.Service.getFeed(Service.java:1017)
at 
ro.servlet.data.ClientAuthenticator.tryGoogleAuthentication(ClientAuthenticator.java:96)
....

 Please tell what shoud I set to contactsService(except setUserToken) in 
order to work proper?

I really need to finish this task, so please, if anyone knows how this can 
be fixed, help me !

Thank you,

Bogdan

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to