How to integrate with google Calendar?

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:

Raveesh Bhalla at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

Gaurav Shah

Related Q & A:

Just Added Q & A:

Find solution

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.