URI error for Android calendar

I am creating a google calendar event from my app.

Somehow it didn't work from one day to the next, it doesn't insert it when I ask to add an event.

I am getting the following error:

02-04 20: 32: 36.975: I / CalendarProvider2 (20633): Send notification Target: Intent {act = android.intent.action.PROVIDER_CHANGED dat = content: //com.android.calendar}

MISTAKE:

02-04 20: 32: 36.975: W / ContentResolver (20633): Failed to get type for: content: //com.android.calendar (Unknown URL Content: //com.android.calendar)

Here is my code:

//create note in google calendar
                long calID = Long.parseLong(calendarId);
                TimeZone timeZone = TimeZone.getDefault();

                ContentResolver cr = getContentResolver();
                ContentValues values = new ContentValues();
                values.put(Events.DTSTART, startMillis);
                values.put(Events.DURATION, "PT1H");
                values.put(Events.TITLE, content);
                values.put(Events.CALENDAR_ID, calID);
                values.put(Events.EVENT_TIMEZONE, timeZone.getID());
                Uri uri = cr.insert(Events.CONTENT_URI, values);

                // get the event ID that is the last element in the Uri
                idSync = (int) Long.parseLong(uri.getLastPathSegment());

      

+3


source to share





All Articles