ionic-team / ionic-team/capacitor-calendar

createEvent fails with permission-denied (OS-PLUG-CLDR-0020) on Android even right after the user grants calendar

Open
#7 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
0
Forks
0
Avg merge
1h 46m
Merged PRs (30d)
3

Description

createEvent fails with permission-denied (OS-PLUG-CLDR-0020) on Android even right after the user grants calendar

Environment:

@capacitor/calendar: 1.0.1
@capacitor/core / @capacitor/android / @capacitor/cli: 8.5.2
Platform: Android (Galaxy A06 with Android 16)
Steps to reproduce:

Call Calendar.checkPermissions() → writeCalendar is not granted.
Call Calendar.requestPermissions({ permissions: ['writeCalendar'] }), await the promise.
The system permission dialog appears; user taps Allow.
The awaited requestPermissions() promise resolves — but immediately after, calling Calendar.createEvent(...) (or checking the resolved permission status) still reports the permission as denied / the create call fails with error code OS-PLUG-CLDR-0020.
Expected: After explicitly awaiting requestPermissions() and having the user grant the permission, createEvent should succeed.

Actual: Still fails with a permission-denied error, with no further attempt succeeding either (not just a one-time race).

Code used:
const status = await Calendar.checkPermissions();
const granted = status.writeCalendar === 'granted'
? status
: await Calendar.requestPermissions({ permissions: ['writeCalendar'] });
if (granted.writeCalendar !== 'granted') {
throw new Error('permission denied'); // <- this is what's hit
}
await Calendar.createEvent({ title, location, notes, startDate, endDate });

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Android flow through Calendar.checkPermissions(), requestPermissions(), and createEvent() on the stated versions and device conditions. Trace the Android permission handling and returned status after the user taps Allow; done means the granted status is reported immediately and createEvent succeeds without another permission attempt.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.