Unable to integrate Google Calendar API in Android app
-
I've been trying for a few days to integrate Google Calendar in my Android app to little success. I've implemented the GData APIs, and used the code they've given for test purposes but keep getting a SAXParser error as below. All I need to do is to create new events in the user's Calendar. 01-23 19:10:40.420: WARN/XmlParser(28605): javax.xml.parsers.ParserConfigurationException: org.xml.sax.SAXNotRecognizedException: http://xml.org/sax/features/external-parameter-entities 01-23 19:10:40.420: WARN/XmlParser(28605): javax.xml.parsers.ParserConfigurationException: org.xml.sax.SAXNotRecognizedException: http://xml.org/sax/features/external-parameter-entities 01-23 19:10:40.420: WARN/XmlParser(28605): at org.apache.harmony.xml.parsers.SAXParserFactoryImpl.newSAXParser(SAXParserFactoryImpl.java:84) 01-23 19:10:40.420: WARN/XmlParser(28605): at com.google.gdata.util.XmlParser.parse(XmlParser.java:682) 01-23 19:10:40.420: WARN/XmlParser(28605): at com.google.gdata.util.XmlParser.parse(XmlParser.java:576) 01-23 19:10:40.420: WARN/XmlParser(28605): at com.google.gdata.data.BaseEntry.parseAtom(BaseEntry.java:1015) 01-23 19:10:40.420: WARN/XmlParser(28605): at com.google.gdata.wireformats.input.AtomDataParser.parse(AtomDataParser.java:59) 01-23 19:10:40.420: WARN/XmlParser(28605): at com.google.gdata.wireformats.input.AtomDataParser.parse(AtomDataParser.java:39) 01-23 19:10:40.420: WARN/XmlParser(28605): at com.google.gdata.wireformats.input.CharacterParser.parse(CharacterParser.java:100) 01-23 19:10:40.420: WARN/XmlParser(28605): at com.google.gdata.wireformats.input.XmlInputParser.parse(XmlInputParser.java:52) 01-23 19:10:40.420: WARN/XmlParser(28605): at com.google.gdata.wireformats.input.AtomDualParser.parse(AtomDualParser.java:66) 01-23 19:10:40.420: WARN/XmlParser(28605): at com.google.gdata.wireformats.input.AtomDualParser.parse(AtomDualParser.java:34) 01-23 19:10:40.420: WARN/XmlParser(28605): at com.google.gdata.client.Service.parseResponseData(Service.java:2165) 01-23 19:10:40.420: WARN/XmlParser(28605): at com.google.gdata.client.Service.parseResponseData(Service.java:2098) 01-23 19:10:40.420: WARN/XmlParser(28605): at com.google.gdata.client.Service.insert(Service.java:1410) 01-23 19:10:40.420: WARN/XmlParser(28605): at com.google.gdata.client.GoogleService.insert(GoogleService.java:606) 01-23 19:10:40.420: WARN/XmlParser(28605): at <packagename>.CalendarDialog.addToCalendar(CalendarDialog.java:160) 01-23 19:10:40.420: WARN/XmlParser(28605): at <packagename>.CalendarDialog.onClick(CalendarDialog.java:125) 01-23 19:10:40.420: WARN/XmlParser(28605): at android.view.View.performClick(View.java:2421) 01-23 19:10:40.420: WARN/XmlParser(28605): at android.view.View$PerformClick.run(View.java:8869) 01-23 19:10:40.420: WARN/XmlParser(28605): at android.os.Handler.handleCallback(Handler.java:587) 01-23 19:10:40.420: WARN/XmlParser(28605): at android.os.Handler.dispatchMessage(Handler.java:92) 01-23 19:10:40.420: WARN/XmlParser(28605): at android.os.Looper.loop(Looper.java:143) 01-23 19:10:40.420: WARN/XmlParser(28605): at android.app.ActivityThread.main(ActivityThread.java:5097) 01-23 19:10:40.420: WARN/XmlParser(28605): at java.lang.reflect.Method.invokeNative(Native Method) 01-23 19:10:40.420: WARN/XmlParser(28605): at java.lang.reflect.Method.invoke(Method.java:521) 01-23 19:10:40.420: WARN/XmlParser(28605): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 01-23 19:10:40.420: WARN/XmlParser(28605): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 01-23 19:10:40.420: WARN/XmlParser(28605): at dalvik.system.NativeStart.main(Native Method) 01-23 19:10:40.420: WARN/System.err(28605): com.google.gdata.util.ParseException: org.xml.sax.SAXNotRecognizedException: http://xml.org/sax/features/external-parameter-entities 01-23 19:10:40.420: WARN/System.err(28605): at com.google.gdata.util.XmlParser.parse(XmlParser.java:708) 01-23 19:10:40.420: WARN/System.err(28605): at com.google.gdata.util.XmlParser.parse(XmlParser.java:576) 01-23 19:10:40.420: WARN/System.err(28605): at com.google.gdata.data.BaseEntry.parseAtom(BaseEntry.java:1015) 01-23 19:10:40.420: WARN/System.err(28605): at com.google.gdata.wireformats.input.AtomDataParser.parse(AtomDataParser.java:59) 01-23 19:10:40.420: WARN/System.err(28605): at com.google.gdata.wireformats.input.AtomDataParser.parse(AtomDataParser.java:39) 01-23 19:10:40.420: WARN/System.err(28605): at com.google.gdata.wireformats.input.CharacterParser.parse(CharacterParser.java:100) 01-23 19:10:40.420: WARN/System.err(28605): at com.google.gdata.wireformats.input.XmlInputParser.parse(XmlInputParser.java:52) 01-23 19:10:40.420: WARN/System.err(28605): at com.google.gdata.wireformats.input.AtomDualParser.parse(AtomDualParser.java:66) 01-23 19:10:40.420: WARN/System.err(28605): at com.google.gdata.wireformats.input.AtomDualParser.parse(AtomDualParser.java:34) 01-23 19:10:40.420: WARN/System.err(28605): at com.google.gdata.client.Service.parseResponseData(Service.java:2165) 01-23 19:10:40.420: WARN/System.err(28605): at com.google.gdata.client.Service.parseResponseData(Service.java:2098) 01-23 19:10:40.420: WARN/System.err(28605): at com.google.gdata.client.Service.insert(Service.java:1410) 01-23 19:10:40.420: WARN/System.err(28605): at com.google.gdata.client.GoogleService.insert(GoogleService.java:606) 01-23 19:10:40.430: WARN/System.err(28605): at <packagename>.CalendarDialog.addToCalendar(CalendarDialog.java:160) 01-23 19:10:40.430: WARN/System.err(28605): at <packagename>.CalendarDialog.onClick(CalendarDialog.java:125) 01-23 19:10:40.430: WARN/System.err(28605): at android.view.View.performClick(View.java:2421) 01-23 19:10:40.430: WARN/System.err(28605): at android.view.View$PerformClick.run(View.java:8869) 01-23 19:10:40.430: WARN/System.err(28605): at android.os.Handler.handleCallback(Handler.java:587) 01-23 19:10:40.430: WARN/System.err(28605): at android.os.Handler.dispatchMessage(Handler.java:92) 01-23 19:10:40.430: INFO/dalvikvm(28605): Jit: resizing JitTable from 4096 to 8192 01-23 19:10:40.440: WARN/System.err(28605): at android.os.Looper.loop(Looper.java:143) 01-23 19:10:40.440: WARN/System.err(28605): at android.app.ActivityThread.main(ActivityThread.java:5097) 01-23 19:10:40.440: WARN/System.err(28605): at java.lang.reflect.Method.invokeNative(Native Method) 01-23 19:10:40.440: WARN/System.err(28605): at java.lang.reflect.Method.invoke(Method.java:521) 01-23 19:10:40.440: WARN/System.err(28605): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 01-23 19:10:40.440: WARN/System.err(28605): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 01-23 19:10:40.440: WARN/System.err(28605): at dalvik.system.NativeStart.main(Native Method) 01-23 19:10:40.440: WARN/System.err(28605): Caused by: javax.xml.parsers.ParserConfigurationException: org.xml.sax.SAXNotRecognizedException: http://xml.org/sax/features/external-parameter-entities 01-23 19:10:40.450: WARN/System.err(28605): at org.apache.harmony.xml.parsers.SAXParserFactoryImpl.newSAXParser(SAXParserFactoryImpl.java:84) 01-23 19:10:40.450: WARN/System.err(28605): at com.google.gdata.util.XmlParser.parse(XmlParser.java:682) 01-23 19:10:40.450: WARN/System.err(28605): ... 25 more The code I used for adding the event is: void addToCalendar() throws IOException, ServiceException { CalendarService myService = new CalendarService("exampleCo-exampleApp-1"); myService.setUserCredentials("<username>@gmail.com", "<password>"); URL postUrl = new URL("https://www.google.com/calendar/feeds/<username>@gmail.com/private/full"); CalendarEventEntry myEntry = new CalendarEventEntry(); myEntry.setTitle(new PlainTextConstruct("Tennis with Beth")); myEntry.setContent(new PlainTextConstruct("Meet for a quick lesson.")); DateTime startTime = DateTime.parseDateTime("2011-01-26T15:00:00+05:30"); DateTime endTime = DateTime.parseDateTime("2011-01-26T15:12:00+05:30"); When eventTimes = new When(); eventTimes.setStartTime(startTime); eventTimes.setEndTime(endTime); myEntry.addTime(eventTimes); // Send the request and receive the response: CalendarEventEntry insertedEntry = myService.insert(postUrl, myEntry); } Any idea what's causing the problem? Also, if anyone's got the Calendar API running, can they provide some help? Like I said, all I need is to add events (both single and recurring) Thanks!
-
Answer:
GData API won't work on your android, use google api client, from here: http://code.google.com/p/google-api-java-client/wiki/Android instead. see: http://stackoverflow.com/questions/524257/best-option-for-using-the-gdata-apis-on-android
Raveesh Bhalla at Stack Overflow Visit the source
Other answers
ldx
you can you use GoogleApiJavaClient see here why : http://code.google.com/p/gdata-java-client/wiki/MigratingToGoogleApiJavaClient look here for more resource http://code.google.com/p/google-api-java-client/
Gaurav Shah
Related Q & A:
- How to Use Google Calendar API?Best solution by Stack Overflow
- How to implement app purchase in Android app?Best solution by Stack Overflow
- How to connect Android app to App engine?Best solution by groups.google.com
- How to integrate paytm wallet for an Android application?Best solution by Stack Overflow
- How do I sync my blackberry calendar to my Google calendar?Best solution by Quora
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.