wmcmahan / react-native-calendar-events

📆 React Native Module for iOS and Android Calendar Events
MIT License
906 stars 292 forks source link

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

Open developerashish01 opened 4 years ago

developerashish01 commented 4 years ago

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

MoOx commented 4 years ago

Please provide more details

developerashish01 commented 4 years ago

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
      });
MoOx commented 4 years ago

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

Also is this working on some device or not?

developerashish01 commented 4 years ago

we are pushing events in local calendar.

Yes it is working fine in some devices

developerashish01 commented 4 years ago

@MoOx any update?

MoOx commented 4 years ago

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 commented 4 years ago

@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?

ghost commented 3 years ago

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.!

wmcmahan commented 3 years ago

@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.

Milanp24 commented 1 year ago

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