1
votes

Been struggling a couple of hours now with Device Calendar. It can not return any calendars that are on the device. I added the following permissions on the build hints in case it needed that.

android.permission.READ_CALENDAR android.permission.WRITE_CALENDAR

The following is my code for this

 DeviceCalendar dc = DeviceCalendar.getInstance();
 dc.getCalendars();

Its returning a null. This means i can't read or write to the device calendars.

1
Permissions should be added automatically with the current version. Did you install via the extension manager? Are you running on the device? - Shai Almog
Yes i added the CN1Calendar lib. I am running on an android phone and it returns null - Tafadzwa Moyo

1 Answers

0
votes

You need to invoke hasPermissions() which will prompt for permission first and then you will be granted/denied permission to access the calendar.