Open scaabel opened 1 week ago
Hey @scaabel and thanks. My assumption is that on the emulator you are not signed in with any google account. And thats why listCalendars
returns only the birthdays and holidays. These calendars are readonly and therefore cant be manipulated.
Your implementation seems to be correct but to be sure I would try just a basic event only with a title to see if everything works as expected.
What i would try is to login with a google account and the emulator (if you havent already) and to see if you have access to your own calendar and if you can add events to it using the method.
If this still didnt work:
What i can offer is to implement a way to know if a calendar is readonly or not (this is already supported on ios). And like this you can filter out the calendars that are readonly.
I noticed your capacitor core version is 5.x.x but you are using the plugin for version 6.x.x. Doesnt this create issues? My expectation is that these major version of these dependencies should always match.
Hi @ebarooni, thanks for the prompt reply.
I've ensured that the emulator has logged in with a proper google account. I've also tried with the demo app provided and it is not working as expected even with the correct versions.
Yes, permissions were requested. The createEvent
function works fine in my iOS app. This only happens in Android devices.
Additionally, when calling the CapactiorCalendar.listCalendars()
, I'm only getting the calendars under Other calendars
alongside Birthday
. When I should be also getting all the calendars under My calendars
. There might be some bug or unintended behaviour in regards of the authorization when getting the calendars (merely a speculation).
@scaabel I will test this behavior and get back to you here.
@ebarooni thanks, really appreciate it.
Hi @scaabel , i tested the behaviors that you reported. However i was not able to reproduce any! For the tests i used the example app from the repo without any modifications. listCalendars
returned all my available calendars and createEvent
saved an event to my personal calendar (both android). For listCalendars
i request first read access and then i invoked the method. The available calendars on my emulator according to the calendar app itself is the following:
And i received all from the plugin as expected. And for creating an event, first i requested write access and then i invoked the method from the example app.
Can you maybe give me more info on your setup? Which framework? What version? What model is the emulator and which android version?
My emulator is a Pixel 7 Pro with API level 34.
@scaabel And also what do you get when you invoke getDefaultCalendar
?
Hi @ebarooni ,
I'm using react/nextjs alongside this package.
Here is my emulator setup: Pixel 3A, API 34
I've attached a screenshot based on the demo app.
Here are the results of the function invoked from the bottom to top:
listCalendars
getDefaultCalendar
createEvent
I hope this information helps.
Hi @scaabel,
If you omitted the calendarId
and no calendar is marked as IS_PRIMARY
, which is indicated by getDefaultCalendar
returning an empty object, then this behavior is expected. I recommend always providing a calendarId
.
@AhegaHOE his issue is that listCalendars
also does not return all available calendars. But now im not so sure why is this happening.
@ebarooni hmm that is odd. I have tested it myself with my personal account and it shows all my calendars... đŸ¤”
@scaabel could you make create a sample project with instructions on how reproduce this? I could also not reproduce it, just like @ebarooni.
Hi, thanks for making such a great package.
I'm on an Android emulator (Google Pixel 3A) and the default calendar app is Google Calendar. I'm facing an issue where the events that I'm trying to save are not actually being added to Google Calendar. The feature I'm building allows users to select multiple events to be synced to their calendar.
I think the issue is caused by the available calendars in when
CapacitorCalendar.listCalendars()
is called. I'm only getting theHolidays
andBirthdays
calendar in the list and both of these calendars are possibly read only. Here is the log of the listlist of calendars [{"id":"1","title":"Holidays in United States","color":"#16A765"},{"id":"2","title":"Birthdays","color":"#92E1C0"}]
.Below is the implementation to handle the creation of events. There are no errors thrown except when I try to omit the
calendarId
.capacitor-calendar version: ^6.7.0 @capacitor/core version: ^5.7.3
Do let me know if there is something wrong with my implementation or if you require further information.
Thanks again for such an amazing package!