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

Unable to save calendar event in Android.

Open tushar-patil-android opened this issue 2 years ago • 3 comments

Trying to save calendar event in android device but getting below error - Error: You don't have permissions to retrieve an event to the users calendar. I already allowed all required permission.

Library version using: react-native-calendar-events: 2.2.0

Application also crashing on RNCalendarEvents.findCalendars(); RNCalendarEvents.saveCalendar(calendar);

Please help me with this.

tushar-patil-android avatar Aug 19 '22 06:08 tushar-patil-android

Any update?

mertcaliskanyurek avatar Sep 14 '22 16:09 mertcaliskanyurek

  1. RNCalendarEvents.requestPermissions()

kanyo33 avatar Oct 22 '22 18:10 kanyo33

Any update?

I think package's developer do not care, so instead waiting for their reply what i did was this

const is_Calender_Permission_Granted = await PermissionsAndroid.check('android.permission.WRITE_CALENDAR'); if (!is_Calender_Permission_Granted) { const granted = await PermissionsAndroid.request( PermissionsAndroid.PERMISSIONS.WRITE_CALENDAR, { title: "ClashHub Needs Calender Permission", message: "So We can Notify you before the Match", buttonNegative: "Cancel", buttonPositive: "OK" } );

i took Permission to write to calendar via this https://reactnative.dev/docs/permissionsandroid .

and dont forget to const TakePermission = await RNCalendarEvents.requestPermissions((true)); before calling RNCalendarEvents.saveEvent function

i don't know why but it will not work without this

Hope It Helps, Happy Coading.

Udbhav9628 avatar Nov 30 '22 14:11 Udbhav9628