I am working on an application that, among other things, allows the user to create reminders and save them on their calendar.
In the current code, a local calendar is first created, and then added to it on demand, quietly (without opening the calendar application).
The problem is that when creating a calendar on some devices, work on the following fields (on Samsung) and on other devices cannot be added 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 these lines could not be executed on some devices, the written code first tried to create a calendar with them, but without error.
The result is higher: on most devices other than Samsung, a damaged calendar was created without required fields, such as ACCOUNT_NAME.
This means that the Google calendar application constantly crashes and cannot be opened even if I delete my application (because a damaged calendar has already been created).
In addition, it seems that I cannot delete this damaged calendar, since I do not have the required fields.
What can I do to fix this?
Right now - all I want to do is the ability to automatically delete this damaged calendar from a user phone, so the calendar application can be used again.
Thanks!