react-native-calendar-events icon indicating copy to clipboard operation
react-native-calendar-events copied to clipboard

CalendarEvents.java line 825 com.calendarevents.CalendarEvents.createRemindersForEvent

Open developerashish01 opened this issue 4 years ago • 10 comments

App is getting crash in some devices while adding events in calendar CalendarEvents.java line 825 com.calendarevents.CalendarEvents.createRemindersForEvent

Fatal Exception: android.database.sqlite.SQLiteException android.database.DatabaseUtils.readExceptionFromParcel (DatabaseUtils.java:184) android.content.ContentResolver.insert (ContentResolver.java:1854) com.calendarevents.CalendarEvents.createRemindersForEvent (CalendarEvents.java:825) com.calendarevents.CalendarEvents.addEvent (CalendarEvents.java:663) com.calendarevents.CalendarEvents.access$200 (CalendarEvents.java:44) com.calendarevents.CalendarEvents$3.run (CalendarEvents.java:1225)

Environment

System: OS: Linux 4.15 Ubuntu 16.04.5 LTS (Xenial Xerus) CPU: (4) x64 Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz Memory: 1.31 GB / 7.71 GB Shell: 4.3.48 - /bin/bash Binaries: Node: 11.11.0 - ~/.nvm/versions/node/v11.11.0/bin/node Yarn: 1.22.4 - /usr/bin/yarn npm: 6.7.0 - ~/.nvm/versions/node/v11.11.0/bin/npm Watchman: Not Found SDKs: Android SDK: API Levels: 10, 19, 21, 23, 24, 25, 26, 27, 28, 29, 8 Build Tools: 21.1.2, 23.0.1, 23.0.2, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.1, 27.0.2, 27.0.3, 28.0.0, 28.0.0, 28.0.1, 28.0.2, 28.0.3, 29.0.2, 29.0.3 System Images: android-28 | Google Play Intel x86 Atom Android NDK: 16.1.4479499 IDEs: Android Studio: Not Found Languages: Java: 1.8.0_201 - /usr/bin/javac Python: 2.7.12 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.11.0 => 16.11.0 react-native: 0.62.2 => 0.62.2 npmGlobalPackages:

Steps to Reproduce

Adding event, it is getting crashed

developerashish01 avatar May 06 '20 10:05 developerashish01

Please provide more details

  • type of calendar
  • list of devices/android version where this happens
  • the code involved to add the event

MoOx avatar May 06 '20 11:05 MoOx

Type of calendar what do you mean by type of calendar

list of devices/android version where this happens

OnePlus asus motorola Xiaomi

the code involved to add the event

RNCalendarEvents.authorizeEventStore()
       .then(out => {
         if (out == 'authorized') {
           // set the new status to the auth state
        
         }
       })
       .catch(error => console.warn('Auth Error: ', error));
RNCalendarEvents.saveEvent(title, {
      location: is_live_class ? null : this.state.address,
      description: this.state.selectedSechedule.sessions_details.description,
      descriptions: this.state.selectedSechedule.sessions_details.description,
      notes: this.state.selectedSechedule.sessions_details.description,
      startDate: moment(startDateUTC).toISOString(),
      endDate: moment(startDateUTC)
        .add(1, 'hours')
        .toISOString(),
      // recurrence: this.state.selectedCustomSegment.value,
      alarms: [
        {
          date: Platform.OS == 'ios' ? -60 : 60,
        },
        // {
        //     date: -300
        // }
      ],
    })
      .then(id => {
        console.log('id uuu', id, title);
     
      })
      .catch(error => {
        // handle error
      });

developerashish01 avatar May 06 '20 13:05 developerashish01

Type of calendar => local? google? iCloud? etc

Also is this working on some device or not?

MoOx avatar May 06 '20 13:05 MoOx

we are pushing events in local calendar.

Yes it is working fine in some devices

developerashish01 avatar May 06 '20 14:05 developerashish01

@MoOx any update?

developerashish01 avatar May 07 '20 10:05 developerashish01

Do you have any android logs to share? Sorry I am new to this package as a maintainer & I am very new to iOS & android languages & way to debugs

MoOx avatar Jun 09 '20 08:06 MoOx

@developerashish01 can you check https://github.com/wmcmahan/react-native-calendar-events/issues/278 & tell me if passing timestamp as some dev recommended is better?

MoOx avatar Aug 01 '20 08:08 MoOx

74% OPPO Operating systems 46% Android 9 Device states 3% background 46% Android 9 26% Android 8 19% Android 10 8% Android 7 <1% Other (1)

any update on this please reply.!

ghost avatar Jan 05 '21 11:01 ghost

@developerashish01 The most common reasons for crashes while creating and event is either permissions to read or write to the calendar store are not set or excepted, or there is malformed data trying to get saved.

It's hard to see from your sample code, since the values are obfuscated as variables. I'm curious if its not your location value here, which seems to be conditionally set to null. The field requires a string, so in this case an empty string might be needed.

wmcmahan avatar Jan 12 '21 15:01 wmcmahan

For me, it is because calendar was not setup, I opened calendar app once after first ever boot/ reset, resolved the issue.

Milanp24 avatar May 09 '23 16:05 Milanp24