Experimenting with how to store data in a Google Spreadsheet from an Android app using the Google API client java library. The example provided by Joel Edström uses and older version of the library, and for me failed to store the spreadsheet with errors "401 Invalid token". Adapting it to use the approach found in the Picasa Android Sample, I was able to make it work: SpreadheetTest2.zip
Hi: can you specify the libs are needed to build the app? Thanks!
ReplyDeleteUnfortunately, I have no longer worked with this code since then, and do not think the approach I used back then, would still work, since the API has changed in the meantime https://developers.google.com/google-apps/spreadsheets/
DeleteHi I new in Android development ,I use your code but it gives error like
ReplyDelete10-18 18:56:22.258: E/AndroidRuntime(330): FATAL EXCEPTION: AsyncTask #1
10-18 18:56:22.258: E/AndroidRuntime(330): java.lang.RuntimeException: An error occured while executing doInBackground()
10-18 18:56:22.258: E/AndroidRuntime(330): at android.os.AsyncTask$3.done(AsyncTask.java:200)
10-18 18:56:22.258: E/AndroidRuntime(330): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
10-18 18:56:22.258: E/AndroidRuntime(330): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
10-18 18:56:22.258: E/AndroidRuntime(330): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
10-18 18:56:22.258: E/AndroidRuntime(330): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
10-18 18:56:22.258: E/AndroidRuntime(330): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
10-18 18:56:22.258: E/AndroidRuntime(330): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
10-18 18:56:22.258: E/AndroidRuntime(330): at java.lang.Thread.run(Thread.java:1096)
10-18 18:56:22.258: E/AndroidRuntime(330): Caused by: java.lang.RuntimeException: java.io.IOException: SSL shutdown failed: I/O error during system call, Broken pipe
10-18 18:56:22.258: E/AndroidRuntime(330): at foo.test.spreadsheettest2.SpreadsheetTestActivity$Task.doInBackground(SpreadsheetTestActivity.java:240)
10-18 18:56:22.258: E/AndroidRuntime(330): at foo.test.spreadsheettest2.SpreadsheetTestActivity$Task.doInBackground(SpreadsheetTestActivity.java:1)
10-18 18:56:22.258: E/AndroidRuntime(330): at android.os.AsyncTask$2.call(AsyncTask.java:185)
10-18 18:56:22.258: E/AndroidRuntime(330): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
10-18 18:56:22.258: E/AndroidRuntime(330): ... 4 more
10-18 18:56:22.258: E/AndroidRuntime(330): Caused by: java.io.IOException: SSL shutdown failed: I/O error during system call, Broken pipe
10-18 18:56:22.258: E/AndroidRuntime(330): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.nativeclose(Native Method)
10-18 18:56:22.258: E/AndroidRuntime(330): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.close(OpenSSLSocketImpl.java:958)
10-18 18:56:22.258: E/AndroidRuntime(330): at org.apache.http.impl.SocketHttpClientConnection.close(SocketHttpClientConnection.java:205)
10-18 18:56:22.258: E/AndroidRuntime(330): at org.apache.http.impl.conn.DefaultClientConnection.close(DefaultClientConnection.java:161)
10-18 18:56:22.258: E/AndroidRuntime(330): at org.apache.http.impl.conn.AbstractPooledConnAdapter.close(AbstractPooledConnAdapter.java:158)
10-18 18:56:22.258: E/AndroidRuntime(330): at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
10-18 18:56:22.258: E/AndroidRuntime(330): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:410)
10-18 18:56:22.258: E/AndroidRuntime(330): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
10-18 18:56:22.258: E/AndroidRuntime(330): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
10-18 18:56:22.258: E/AndroidRuntime(330): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
10-18 18:56:22.258: E/AndroidRuntime(330): at com.google.api.client.http.apache.ApacheHttpRequest.execute(ApacheHttpRequest.java:58)
10-18 18:56:22.258: E/AndroidRuntime(330): at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:814)
10-18 18:56:22.258: E/AndroidRuntime(330): at foo.joeledstrom.spreadsheets.SpreadsheetsService$4.run(SpreadsheetsService.java:313)
As said, the API has changed in the meantime, so my code is no longer relevant.
ReplyDeleteSorry, I hope to find time to look into the new API soon.