Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 谷歌联系android上的api_Java_Android_Google Contacts Api - Fatal编程技术网

Java 谷歌联系android上的api

Java 谷歌联系android上的api,java,android,google-contacts-api,Java,Android,Google Contacts Api,这件事我已经做了好几天了,我感到很困惑 我在很多地方读到过谷歌提供的java客户端“无法在android上工作”,但事实并非如此 有人能给我指一下正确的方向吗 public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ContactsService service = new ContactsS

这件事我已经做了好几天了,我感到很困惑

我在很多地方读到过谷歌提供的java客户端“无法在android上工作”,但事实并非如此

有人能给我指一下正确的方向吗

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("anAccount@gmail.com", "thePassword");

        ContactFeed resultFeed = new ContactFeed();

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

}
我得到:

W/XmlParser(793): javax.xml.parsers.ParserConfigurationException: org.xml.sax.SAXNotRecognizedException: http://xml.org/sax/features/external-parameter-entities W/XmlParser(793):javax.xml.parsers.ParserConfigurationException:org.xml.sax.SAXNotRecognizedException:http://xml.org/sax/features/external-parameter-entities
如果你想要手机用户的联系人,为什么不试试?

有一个新的谷歌API Java客户端库,可以在Android上运行,它位于


我个人曾在Google Documents List API中使用过这一点(不过,它确实需要按照创建XML模型类)。

@norbert您有什么解决方案吗?你能和我分享你的代码或链接吗?我已经解决了GDataAPI的问题。查看此帖子()此链接现在已失效。回答不正确。在回答之前仔细阅读问题。