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
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
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.
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
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.
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
Get the GData Java library (via the language guide)
Get the 3 jars from the Android Javamail port
Add the following jars in your lib folder, add them to the path using the context menu (Build path->Add)
Don't forget to add the INTERNET permission in your AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
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();
}
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.