Open mabudiman opened 4 years ago
It's mentioned here too https://github.com/vonovak/react-native-add-calendar-event/issues/89
yes, it's currently possible that the result is wrong, because the native apis on android are pretty horrible. This can be improved if you dig into it, but I'm not currently using this module so I don't have plans to do so. Help is appreciated.
Please could you put a warning on this package and state clearly that "this module is not reliable with android and lead to unpredictable results ?". I have "wasted" a fair amount of time configuring and installing it to get at the end a false positive CANCELED EVENT raised to the user. The event is saved and my application display "the event has been cancelled"....
Same application same version deployed on stores : Samsung Galaxy S7 => SAVED event returned in the promise, Samsung Galaxy S10 => CANCELED. Clearly it is not reliable.
@dngconsulting I wanted to share my knowledge on this. Google's native calendar app takes over the "Activity" and RN app goes into background, once resumed the callbacks are replayed however "canceled" For "skinned" android systems like Samsung and Samsung One UI, Huawei, etc , the calendar is a separate app and successfully returns and replays state with a full object.
Hope its helpful to others
@jeveloper
I am used that react-native-add-calendar-event package.
click addToCalendar function ,
export const addToCalendar = () => {
const eventConfig = {
title: "eventTitle",
startDate: utcDateToString(moment.utc()),
endDate: utcDateToString(moment.utc().add(1, "hours")),
notes: "tasty!",
navigationBarIOS: {
translucent: false,
tintColor: "orange",
barTintColor: "orange",
backgroundColor: "green",
titleColor: "blue",
},
};
request(
Platform.select({
ios: PERMISSIONS.IOS.CALENDARS,
default: PERMISSIONS.ANDROID.WRITE_CALENDAR,
})
)
.then((result) => {
if (result !== RESULTS.GRANTED) {
throw new Error(No permission: ${result}
);
}
return AddCalendarEvent.presentEventCreatingDialog(eventConfig);
})
.then((eventInfo) => {
console.warn(JSON.stringify(eventInfo));
})
.catch((error) => {
console.warn(error);
});
}
The app is crash like goes to the background I couldn't find solution what is the cause of the problem
@kannan-rjp Hi, Just following up, much later than I would've. Can you paste your piece of code in something more readable for me and others please. Also, I would recommend looking at expo libraries or others that are maintained. Crashing information should be logged
Ok i will post.
On Tue, 4 Jun 2024 at 22:33, Serge Bornow @.***> wrote:
@kannan-rjp https://github.com/kannan-rjp Hi, Just following up, much later than I would've. Can you paste your piece of code in something more readable for me and others please. Also, I would recommend looking at expo libraries or others that are maintained. Crashing information should be logged
— Reply to this email directly, view it on GitHub https://github.com/vonovak/react-native-add-calendar-event/issues/94#issuecomment-2148009835, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOZWTK33SV42MOQBJO4CLP3ZFXXPPAVCNFSM4KKCIKHKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJUHAYDAOJYGM2Q . You are receiving this because you were mentioned.Message ID: @.***>
eventInfo
from promisepresentEventCreatingDialog
return{ action: 'CANCELED' }
instead{ action: 'SAVED', eventIdentifier: string, calendarItemIdentifier: string }
when event saved by user.I'm using android 9 pie. am i missing something?