How can I automatically delete my own damaged calendar?

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!

+5
source share
1 answer

Try to use this application to remove the failed calendar.

iCal Import / Export CalDAV

Open the application and do the following:

  1. Select Change Calendars

  2. Select your faulty calendar under Type: Local

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

Hope this helps with your issue.

0
source

Source: https://habr.com/ru/post/1240616/


All Articles