Best option for using the GData APIs on Android?

前端 未结 5 1577
醉梦人生
醉梦人生 2020-12-04 11:32

What\'s the least painful and most size efficient way to use the Google Data APIs in an Android application?

After a few quick searches t seems that there is an andr

相关标签:
5条回答
  • 2020-12-04 11:48

    I also looked at the google-code project and the git repo. I steered away from the google-code project due to the apparent baggage that came along in required projects. I ended up creating custom implementations as necessary to adapt the standard java API. You can find a rough description of my solution in the android-developers group. It is 4 short, easily tested classes

    0 讨论(0)
  • 2020-12-04 11:52

    I used this API

    I tried converting it to a .jar, but had problems. I found it easy to mark the project as a library project and then used it in my main project.

    0 讨论(0)
  • 2020-12-04 11:57

    Please try Google SpreadSheet API for Android

    I am maintaining this project on Google Code, so if you face any problem, kindly let me know.

    Cheers, Prasanta

    0 讨论(0)
  • 2020-12-04 12:04

    Please take a look at the Google API Client Library for Java which supports Android

    It also supports new GData technologies like the recently announced partial response/update and JSON-C, both of which can be a dramatic improvement in efficiency on Android.

    To start, please take a look at the Android Developer's Guide. Also, please look at the Android sample for Picasa Web Albums Data API, which demonstrates the ability create/update/delete a photo album and to upload a picture.

    Full disclosure: I am an owner of the google-api-java-client project.

    0 讨论(0)
  • 2020-12-04 12:04

    Here's some steps to getting the Google Docs api working with an Android Eclipse project.

    Spoiler: it breaks (for me) on the SAX exception

    1

    Get the GData Java library (via the language guide)

    2

    Get the 3 jars from the Android Javamail port

    3

    Add the following jars in your lib folder, add them to the path using the context menu (Build path->Add)

    • activation.jar (javamail)
    • additionnal.jar (javamail)
    • mail.jar (javamail)
    • gdata-client-1.0.jar
    • gdata-client-meta-1.0.jar
    • gdata-core-1.0.jar
    • gdata-docs-3.0.jar
    • gdata-docs-meta-3.0.jar
    • gdata-gtt-2.0.jar
    • gdata-gtt-meta-2.0.jar
    • gdata-media-1.0.jar
    • google-collect-1.0-rc1.jar (from the deps folder of the gdata folder)
    • jsr305.jar3. (from the deps folder of the gdata folder)

    4

    Don't forget to add the INTERNET permission in your AndroidManifest.xml:

    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    

    5

    Try out some example code:

    DocsService client = new DocsService("myappname");
    try
    {
        client.setUserCredentials("username", "password");
    
        URL feedUri = new URL("https://docs.google.com/feeds/default/private/full/");
        DocumentListFeed feed = client.getFeed(feedUri, DocumentListFeed.class);
    
        TextView textView = (TextView) findViewById(R.id.textview);
    
        String text = ""; 
        for (DocumentListEntry entry : feed.getEntries())
        {
            text += entry.getTitle().getPlainText() + "\r\n";
        }
    
        textView.setText(text);
    }
    catch (AuthenticationException e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    catch (MalformedURLException e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    catch (IOException e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    catch (ServiceException e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    

    6

    Accept defeat after 2 hours, with a SaxException from logcat:

    WARN/XmlParser(1599): javax.xml.parsers.ParserConfigurationException:
    org.xml.sax.SAXNotRecognizedException: http://xml.org/sax/features/external-parameter-entities
    ...
    at com.google.gdata.wireformats.input.AtomDataParser.parse(AtomDataParser.java:68)

    This last step causes a ServiceException.

    0 讨论(0)
提交回复
热议问题