Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google contacts api on android

I've been at this for days and im getting confused.

I've read in many places that the java client google provides "wont work on android", and it doesn't.

Could anybody point me in the right direction?

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);


    ContactsService service = new ContactsService("my_app_name");


    URL feedUrl = null;
    try {
        feedUrl = new URL("https://www.google.com/m8/feeds/contacts/default/full");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }

    try {
        service.setUserCredentials("[email protected]", "thePassword");

        ContactFeed resultFeed = new ContactFeed();

        resultFeed = service
                .getFeed(feedUrl, ContactFeed.class);
    } catch (IOException e) {
        e.printStackTrace();
    } catch (ServiceException e) {
        e.printStackTrace();
    }

}

And i get:

W/XmlParser(793): javax.xml.parsers.ParserConfigurationException: org.xml.sax.SAXNotRecognizedException: http://xml.org/sax/features/external-parameter-entities
like image 461
Norbert Bicsi Avatar asked May 09 '26 06:05

Norbert Bicsi


1 Answers

There is a newer Google APIs Java Client library that DOES work on Android, and it's at http://code.google.com/p/google-api-java-client/.

I have personally used this with the Google Documents List API (however, it did require creating XML model classes as per http://code.google.com/p/google-api-java-client/wiki/APIs#Google_Data_APIs).

like image 148
Jomel Imperio Avatar answered May 11 '26 18:05

Jomel Imperio



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!