Skip to content

fix(widget): standardize alarm interval to 10 minutes and document updatePeriodMillis limitation#20482

Merged
david-allison merged 1 commit intoankidroid:mainfrom
MandeepT19:fix/widget-alarm-interval
Mar 15, 2026
Merged

fix(widget): standardize alarm interval to 10 minutes and document updatePeriodMillis limitation#20482
david-allison merged 1 commit intoankidroid:mainfrom
MandeepT19:fix/widget-alarm-interval

Conversation

@MandeepT19
Copy link
Contributor

@MandeepT19 MandeepT19 commented Mar 15, 2026

Purpose / Description:
There was a difference between a comment and the real code and also proposed a new approach

Fixes

There is no issue number since this was TODO and it is located inside the widget_provider_deck_picker.xml at line 11

Approach

So it was mentioned to use updatePeriodMillis and by research i found out it's minimum time is for 30 mins and that time is slower/delayed when the widget is added because it can create inconsistency and confusion for the user and the code was not following the 10 mins thing mentioned in the TODO so updated it to 10 minutes instead of being set at 1 minute.

How Has This Been Tested?

The tests were performed on the emulator device and it was running successfully without any error or crash

##Learning (optional, can help others)
Referred topic for this problem was updatePeriodMillis, source for learning were developer.android.com

Checklist

  • [✓] You have a descriptive commit message with a short title (first line, max 50 chars).
  • [✓] You have commented your code, particularly in hard-to-understand areas
  • [✓] You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@welcome
Copy link

welcome bot commented Mar 15, 2026

First PR! 🚀 We sincerely appreciate that you have taken the time to propose a change to AnkiDroid! Please have patience with us as we are all volunteers - we will get to this as soon as possible.

@MandeepT19 MandeepT19 changed the title Fix inside Widget: Fixed the alarm interval to 10 mins and performed documentation fix(widget): standardized alarm interval to 10 minutes and documented regarding updatePeriodMillis limitation Mar 15, 2026
@MandeepT19 MandeepT19 force-pushed the fix/widget-alarm-interval branch from 193be65 to 05c77ea Compare March 15, 2026 16:38
@MandeepT19 MandeepT19 changed the title fix(widget): standardized alarm interval to 10 minutes and documented regarding updatePeriodMillis limitation fix(widget): standardize alarm interval to 10 minutes and document updatePeriodMillis limitation Mar 15, 2026
Comment on lines +104 to +105
SystemClock.elapsedRealtime() + 10.minutes.inWholeMilliseconds,
10.minutes.inWholeMilliseconds,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't 1 minute a better duration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the real reason for suggesting this approach is that by using 1 minute there are few drawbacks like: as we are firing it every minute then it will drain the battery more faster and it was also mentioned for the 10 mins in the TODO and the code was mismatching and reason behind choosing 10 mins was because it is neutral for it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Na, revert it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, reverting it back in a minute

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Mar 15, 2026
@MandeepT19 MandeepT19 force-pushed the fix/widget-alarm-interval branch from 41c86cf to 3e0c59d Compare March 15, 2026 18:06
Comment on lines +11 to +13
<!-- Note: It was suggested to use updatePeriodMillis but it has a minimum of 30 mins enforced by the android
which is too infrequent for due card count as it can create difficulty for the user,
and used a 10 minutes alarm as it was intended.-->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<!-- Note: It was suggested to use updatePeriodMillis but it has a minimum of 30 mins enforced by the android
which is too infrequent for due card count as it can create difficulty for the user,
and used a 10 minutes alarm as it was intended.-->

Comment on lines +9 to +11
<!-- Note: It was suggested to use updatePeriodMillis but it has a minimum of 30 mins enforced by the android
which is too infrequent for due card count as it can create difficulty for the user,
and used a 10 minutes alarm as it was intended-->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<!-- Note: It was suggested to use updatePeriodMillis but it has a minimum of 30 mins enforced by the android
which is too infrequent for due card count as it can create difficulty for the user,
and used a 10 minutes alarm as it was intended-->

@david-allison
Copy link
Member

If the TODOs aren't actionable, just remove them

@MandeepT19
Copy link
Contributor Author

If the TODOs aren't actionable, just remove them

Understood, removing the TODOs entirely

…r XML files

`updatePeriodMillis` has a minimum of 30 mins

Co-authored-by: David Allison <62114487+david-allison@users.noreply.github.com>
@david-allison david-allison force-pushed the fix/widget-alarm-interval branch from a01ea9b to f559049 Compare March 15, 2026 18:40
@david-allison david-allison added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Author Reply Waiting for a reply from the original author Needs Review labels Mar 15, 2026
@david-allison david-allison enabled auto-merge March 15, 2026 18:41
@david-allison david-allison added this pull request to the merge queue Mar 15, 2026
Merged via the queue into ankidroid:main with commit 59c077e Mar 15, 2026
15 checks passed
@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Mar 15, 2026
@github-actions github-actions bot added this to the 2.24 release milestone Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants