ToDont icon indicating copy to clipboard operation
ToDont copied to clipboard

[Bug]: App Crashes When Setting Habit Reminder Frequency to "Once"

Open runnnnnner200 opened this issue 11 months ago • 0 comments

:writing_hand: Describe the bug

When modifying a habit reminder, selecting the frequency as "Once" causes the app to crash due to a SecurityException related to missing the SCHEDULE_EXACT_ALARM permission.

:bomb: Steps to reproduce

  1. Create any habit.
  2. Edit the habit reminder.
  3. Set the reminder frequency to "Once".

:wrench: Expected behavior

The app should handle this case properly by either requesting the required permission or falling back to a non-exact alarm scheduling method if the permission is missing.

:camera: Screenshots

https://github.com/user-attachments/assets/7f205a64-3e35-43c6-a814-4290fe765698

:iphone: Tech info

  • Device: generic_x86_64 (Android Studio x86 emulator)
  • OS: Android 12.0 (Default Android System Image, API31)
  • Version: [To be added manually]

:page_facing_up: Additional context

Crash Log

Exception dispatching input event.  (InputEventReceiver)
Exception in MessageQueue callback: handleReceiveCallback  (MessageQueue-JNI)
java.lang.SecurityException: Caller rocks.poopjournal.todont needs to hold android.permission.SCHEDULE_EXACT_ALARM to set exact alarms.  (MessageQueue-JNI)
at android.os.Parcel.createExceptionOrNull(Parcel.java:2426)  (MessageQueue-JNI)
at android.os.Parcel.createException(Parcel.java:2410)  (MessageQueue-JNI)
at android.os.Parcel.readException(Parcel.java:2393)  (MessageQueue-JNI)
at android.os.Parcel.readException(Parcel.java:2335)  (MessageQueue-JNI)
at android.app.IAlarmManager$Stub$Proxy.set(IAlarmManager.java:359)  (MessageQueue-JNI)
at android.app.AlarmManager.setImpl(AlarmManager.java:947)  (MessageQueue-JNI)
at android.app.AlarmManager.setImpl(AlarmManager.java:907)  (MessageQueue-JNI)
at android.app.AlarmManager.setExact(AlarmManager.java:705)  (MessageQueue-JNI)
at rocks.poopjournal.todont.utils.HabitsBottomSheetDialog.scheduleNotification(HabitsBottomSheetDialog.kt:262)  (MessageQueue-JNI)
...

runnnnnner200 avatar Mar 28 '25 02:03 runnnnnner200