5

I'm working on an app that, among other things, allows the user to create reminders and save them in his calendar.

The current code first creates a local calendar, and later inserts events to it upon request, quietly (without opening the calendar app).

The problem is that during the creation of the calendar, on some devices, adding the following fields work (on Samsung), and on other devices it can't add them directly:

contentValues.put(CalendarContract.Calendars.ACCOUNT_NAME, ApplicationState.getCurrentUser().getFullName());
contentValues.put(CalendarContract.Calendars.ACCOUNT_TYPE, "LOCAL");
contentValues.put(CalendarContract.Calendars.CALENDAR_ACCESS_LEVEL, CalendarContract.Calendars.CAL_ACCESS_OWNER);
contentValues.put(CalendarContract.Calendars.OWNER_ACCOUNT, ApplicationState.getCurrentUser().getEmail());

Since those lines couldn't be performed on some devices, the code written tried first to create the calendar with them, and on failure - without.

The result of the above is: on most of the devices other than Samsung, a corrupted calendar was created, without the compulsory fields such as ACCOUNT_NAME.

Which means: the native google calendar app crashes all the time, and can't be opened, even if I delete my app (since the corrupted calendar was already created).

Furthermore, it seems like I can't delete this corrupted calendar, since I don't have on it those necessary fields..

What can I do to fix it?

Right now - all I want to do is to be able to delete this corrupted calendar from the user's phone programmatically, so the calendar app can be used once again.

Thanks!

limlim
  • 3,115
  • 2
  • 34
  • 46

1 Answers1

0

Try using this app to delete the faulty calendar

iCal Import/Export CalDAV

Open the app and do the following:

  1. Select Edit Calendars

  2. Choose your faulty calendar under the Type:Local

  3. Select the delete calendar option and you're done

Hope this helps with your issue.

Cypher0041
  • 28
  • 6