Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

Additional Widgets: `setRecurringAlarm` is not called from AnkiDroid startup

Open david-allison opened this issue 2 years ago • 10 comments

david-allison avatar Sep 28 '24 15:09 david-allison

  • Likely related: https://github.com/ankidroid/Anki-Android/issues/17151

david-allison avatar Sep 28 '24 15:09 david-allison

Hello 👋, this issue has been opened for more than 3 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

github-actions[bot] avatar Dec 31 '24 14:12 github-actions[bot]

Hello 👋, this issue has been opened for more than 3 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

github-actions[bot] avatar Apr 03 '25 16:04 github-actions[bot]

Hello 👋, this issue has been opened for more than 3 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

github-actions[bot] avatar Jul 03 '25 00:07 github-actions[bot]

Hello 👋, this issue has been opened for more than 3 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

github-actions[bot] avatar Oct 01 '25 02:10 github-actions[bot]

Hello 👋, this issue has been opened for more than 3 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

github-actions[bot] avatar Dec 30 '25 11:12 github-actions[bot]

Hi @david-allison 👋 I looked into this and it seems setRecurringAlarm is not triggered on app startup. I'm thinking of restoring alarms in AnkiDroidApp.onCreate() by retrieving active widget IDs and calling setRecurringAlarm for each. Does this approach sound correct?

DoomsCoder avatar Mar 22 '26 11:03 DoomsCoder

Check with @xenonnn4w, it's been a long time since I looked into this.

If there's no reply, have a dive into the docs and see what you find

david-allison avatar Mar 22 '26 13:03 david-allison

Thanks ! I'll take look and start working on this.

DoomsCoder avatar Mar 22 '26 17:03 DoomsCoder

Hi @xenonnn4w 👋 I was able to reproduce the issue.

Image

After the widget sets the alarm, if the app process is killed (e.g., swiping from recents), the AlarmManager alarms are cleared. When the app process starts again in the background, setRecurringAlarm is not triggered, and no new alarm is created. This causes the widget to stop updating. I'm planning to restore the alarms in AnkiDroidApp.onCreate() by iterating over active widget IDs. Does this approach look correct ?

DoomsCoder avatar Mar 23 '26 15:03 DoomsCoder