Hi, thanks for the reply. I did it with raw XML in the end, wasn't exactly easy to figure out but it was simpler than i expected.
On Wed, Feb 25, 2009 at 4:17 AM, Trevor Johns <[email protected]> wrote: > > On Sat, Jan 31, 2009 at 4:43 AM, Teo <[email protected]> wrote: > > > > Hi everyone, this is my first post here :) > > > > I'm currently working on a feature for my Android app, that will let > > users synchronize stuff to their Google Calendar. The problem is the > > insert method keeps throwing an IOException and i don't know why (its > > message says 'unknown error'). Here's the code i'm working with: > > > > > > > > private static CalendarService mCalendarService; > > private static URL mAllCalendarsFeedUrl=null; > > > > private static final String ALLCALENDARS_FEED_URL_SUFFIX = > > "/private/full"; > > > > private static final String METAFEED_URL_BASE = > > "http://www.google.com/calendar/feeds/"; > > > > public final static boolean createEvent(String title) { > > authenticate(*,*); > > CalendarEventEntry myEntry = new > CalendarEventEntry(); > > myEntry.setTitle(new PlainTextConstruct(title)); > > myEntry.setContent(new > PlainTextConstruct("Tag-ToDo-List")); > > DateTime startTime = new DateTime(new Date()); > > When eventTimes = new When(); > > eventTimes.setStartTime(startTime); > > myEntry.addTime(eventTimes); > > > > // Send the request and receive the response: > > try { > > CalendarEventEntry insertedEntry = > mCalendarService.insert > > (mAllCalendarsFeedUrl, myEntry); > > } catch (IOException e) { // it throws this > exception every time, > > dunno what i'm doing wrong > > // TODO Auto-generated catch block > > e.printStackTrace(); > > } catch (ServiceException e) { > > // TODO Auto-generated catch block > > e.printStackTrace(); > > } > > > > return true; > > } > > > > public final static boolean authenticate(String userName, String > > userPassword){ > > > > // Create necessary URL objects > > try { > > mAllCalendarsFeedUrl = new URL(METAFEED_URL_BASE + userName > + > > ALLCALENDARS_FEED_URL_SUFFIX); > > } catch (MalformedURLException e) { > > // Bad URL > > System.err.println("Uh oh - you've got an invalid URL."); > > e.printStackTrace(); > > return false; > > } > > > > // Create CalendarService and authenticate using ClientLogin > > mCalendarService = new CalendarService("Tag-ToDo-List"); > > > > try { > > mCalendarService.setUserCredentials(userName, userPassword); > > } catch (Exception e) { > > // Invalid credentials > > e.printStackTrace(); > > } > > > > return true; > > } > > > > Teo, > Right now, the Java client library we publish isn't fully compatible > with Android. > > You're welcome to try and get it working (some people have had some > success after hacking some of the SSL/auth code), but out of the box > many things don't work when trying to use the client on Android, which > means I can't be of much direct help here. > > -- > Trevor Johns > > > > -- Teo (a.k.a. Teominator a.k.a. Teodor Filimon) site www.teodorfilimon.com | blog www.teodorfilimon.blogspot.com GMT +2 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Calendar Data API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-calendar-help-dataapi?hl=en -~----------~----~----~----~------~----~------~--~---
