FossifyOrg / Calendar

A simple calendar with events, customizable widgets and no ads.
https://www.fossify.org
GNU General Public License v3.0
814 stars 54 forks source link

Missing Calendar Reminders on Android 14 #217

Open Neiyk opened 7 months ago

Neiyk commented 7 months ago

Checklist

Affected app version

1.0.3

Affected Android/Custom ROM version

Android 14

Affected device model

Samsung Galaxy S22

How did you install the app?

Google Play Store

Steps to reproduce the bug

  1. Install Fossify Calendar on Android 14 device
  2. Grant Fossify Calendar all needed Permissions
  3. Exclude Fossify Calendar in Android settings from Energy saving
  4. Allow Fossify Calendar in Android settings to run all the time in Background
  5. Set an time in Fossify Calendar in two hours with two different times 30 minutes before and one at begin
  6. Close all apps
  7. wait for reminder
  8. Repeat steps 1. to 7. but now restart your smartphone instead of closing all apps

Expected behavior

All timer reminders should appear exactly on time

Actual behavior

Timer reminders from Fossify Calendar are missing, coming to late or will come only if the app will opened manually

Screenshots/Screen recordings

No response

Additional information

Hello,

Fossify Calendar (and also Simple Calendar) do not activate the reminders on the right time, many hours to late or only if the calendar app will manually opened on Android 14 (might be also an issue on Android 13). The issue appears even Fossify Calendar is excluded from Android energy saving and allowed all the time to run in the background.

As you can also see on the Google Play store reviews for Simple Calendar many users have the same issue with missing or "forgotten" reminders.

The cause seems the changed permissions rights in Android 13/14 to set exact timers as documented in Google Developer forum.

I have two different Samsung Galaxy smartphones with Android 14 (and One UI Version 6.0) with that issue.

Could you please check/fix that issue and test it with an Android 14 device?     Schedule exact alarms are denied by default (more details see on source page) https://developer.android.com/about/versions/14/changes/schedule-exact-alarms :

Schedule exact alarms are denied by default

Exact alarms are meant for user-intentioned notifications or actions that need to happen at a precise time.

SCHEDULE_EXACT_ALARM, the permission introduced in Android 12 for apps to schedule exact alarms, is no longer being pre-granted to most newly installed apps targeting Android 13 and higher (will be set to denied by default). If the user transfers app data to a device running Android 14 through a backup-and-restore operation, the permission will still be denied. If an existing app already has this permission, it'll be pre-granted when the device upgrades to Android 14.

The SCHEDULE_EXACT_ALARM permission is required to initiate exact alarms via the following APIs or a SecurityException will be thrown:

  • setExact()
  • setExactAndAllowWhileIdle()
  • setAlarmClock()

Existing best-practices for the SCHEDULE_EXACT_ALARM permission still apply, including the following:

  • Check the permission with canScheduleExactAlarms() before scheduling exact alarms.
  • Set up your app to listen and properly react to the foreground broadcast AlarmManager.ACTION_SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED, which the system sends when the user grants the permission.

Affected apps

If a device is running Android 14 or higher, this change will affect a newly installed app that has the following characteristics:

  • Targets Android 13 (API level 33) or higher.
  • Declares the SCHEDULE_EXACT_ALARM permission in the manifest.
  • Doesn't fall under an exemption or pre-grant scenario.
  • Isn't a calendar or alarm clock app.

Calendar and alarm clock apps should declare USE_EXACT_ALARM

Calendar or alarm clock apps need to send calendar reminders, wake-up alarms, or alerts when the app is no longer running. These apps can request the USE_EXACT_ALARM normal permission. The USE_EXACT_ALARM permission will be granted on install, and apps holding this permission will be able to schedule exact alarms just like apps with the SCHEDULE_EXACT_ALARM permission."

  See also

Android 12: Using SCHEDULE_EXACT_ALARM permission to get/show data at specific time are safe in Google Play Policy? https://stackoverflow.com/questions/71031091/android-12-using-schedule-exact-alarm-permission-to-get-show-data-at-specific-t

Android 14 - Behavior changes: all apps Core functionality -> Schedule exact alarms are denied by default https://developer.android.com/about/versions/14/behavior-changes-all

Aga-C commented 7 months ago

If anybody else also encounters this bug, please write your device model and OS version. I have Android 14 (OnePlus 9 Pro), and all reminders are working correctly. On Android 13 I also didn't have any problems with that.

DazzyWalkman commented 6 months ago

I have the same issue as OP. Redmi Note 11 5G (evergo), Android 13, MIUI 14.0.4. The stock calendar app reminder works fine.

nofishonfriday commented 6 months ago

The cause seems the changed permissions rights in Android 13/14 to set exact timers as documented in Google Developer forum.

It's already using the new USE_EXACT_ALARM permission: https://github.com/FossifyOrg/Calendar/blob/a83b9419aec0f63ffced5b5ddb95f4184b56e5a0/app/src/main/AndroidManifest.xml#L12

(Though I have no idea what else the issue could be, nor have a Android 14 device to test.)

tobykurien commented 5 months ago

Same issue on Nokia One Plus with Android 11, Fossify Calendar v1.0.3 from F-Droid. All battery optimisations turned off (Battery manager off, don't optimize battery for Fossify Calendar, override "do not disturb"). Also followed the instructions at https://dontkillmyapp.com/hmd-global without luck. If I create an event with a reminder within a few hours, it works for that event, but if it's a recurring event, it won't notify the next day or any day thereafter.

The solution to this might be to create a persistent foreground service that prevents the app from being killed. Perhaps it can also "refresh" the alarms if they get killed/removed.

cahogithub commented 3 months ago

Same issue on Xiaomi Mi Note 10 Lite with Android 12 Fossify Calendar v1.0.3 from F-Droid

My work around: Export all to a isc file, delete all appointments and reimport all after restart.

tobykurien commented 3 months ago

Same issue on Nokia One Plus with Android 11, Fossify Calendar v1.0.3 from F-Droid.

A workaround for me is to install the Calendar Notifications app from F-droid which works just fine: https://f-droid.org/en/packages/com.github.quarck.calnotify/

Perhaps the devs can look into what that app has done to make the notifications work reliably (even without using the setAlarmClock method in the settings of that app).

jenda69 commented 2 months ago

Same issue on Nothing Phone (2a), Android 14, battery usage set to unrestricted. I created a test event few minutes in the future and got notified OK. Then I left the phone on the table over night and in the morning notifications for ordinary events didn't go off.

adrnam commented 5 days ago

Same issue on Xiaomi 12T, Android 14 UP1A.230905.011 , security update 2024-09-01. If I set reminder "one hour before" event, the notification is delayed. For example, I set an event at 13h and a reminder one hour before, then I receive the notification at 12h07.