You're adding an event that's not linked to a row in the calendars table for one.
Typically you need to set the value of "calendar_id" to something. This "something" better be a valid _id value from the calendars table or your app will just be filling the provider with crap. If you're going to be messing around in undocumented providers you should probably start by looking at the provider code itself: http://android.git.kernel.org/?p=platform/packages/providers/CalendarProvider.git;a=tree;f=src/com/android/providers/calendar;h=240974b9e76a1c95fb7a20069e0848f913abbef7;hb=25b0f0ee070a5fff18cfcaffa86cb1607941c8a5 Also.. the provider is a bit peculiar on all-day events.. plz make sure you're pushing them in in UTC-time with the event time zone set to UTC also. Look at the implementation in the Calendar app itself: http://android.git.kernel.org/?p=platform/packages/apps/Calendar.git;a=tree;f=src/com/android/calendar;h=e0c3f3cc9249fb9b0cf278a8338e362fdf3e9f4a;hb=14e77164bddf4d29acaca5bb2ff116a697bf9650 -- (or you could just do it with GDATA as M.Murphy suggests and push your messages via HTTP up to Google which should sync it back to the device sooner or later). On 8 Okt, 12:40, Kapuddi <kapu...@gmail.com> wrote: > Hello, All: > > when I insert one new Calendar Event into Google calendar from my app, > the log message was given: > ================================================================================ > 10-05 00:30:44.171: ERROR/DatabaseUtils(8479): Error inserting > transparency=0 dtstart=1285891200000 title=TestCalendar _sync_dirty=1 > dtend=1285891200000 visibility=0 allDay=1 lastDate=1285950628697 > hasAlarm=0 eventStatus=1 into table Events > 10-05 00:30:44.171: ERROR/DatabaseUtils(8479): > android.database.sqlite.SQLiteConstraintException: error code 19: > constraint failed > 10-05 00:30:44.171: ERROR/DatabaseUtils(8479): at > android.database.sqlite.SQLiteStatement.native_execute(Native Method) > ================================================================================ > > would you please tell me how to solve it? > > Best Regards, > > Kapuddi > > ================================================================================ > Next is my sample code: > // Platform: android 2.2 froyo > > private static final String calendarcontentStr = > "content://com.android.calendar/events"; > > ContentValues event = new ContentValues(); > > //event.put("title", mAct.getString(R.string.read) + ": " + title); > event.put("title", "TestCalendar"); > > long startTime = startC.getTimeInMillis(); > long endTime = endC.getTimeInMillis(); > > event.put("dtstart", startTime); > event.put("dtend", endTime); > //event.put("allDay", 1); > event.put("eventStatus", 1); > event.put("visibility", 0); > event.put("transparency", 0); > event.put("hasAlarm", 0); > > Uri eventsUri = Uri.parse(calendarcontentStr); > Uri uri = mAct.getContentResolver().insert(eventsUri, event); -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en