How it works
AnkiBlock is a study gate for Android: it blocks apps and websites you choose until you complete enough Anki cards. Your flashcards, notes, media, and review history stay in AnkiDroid. AnkiBlock never hosts your collection and does not replace AnkiDroid’s reviewer — it reads your real study progress through AnkiDroid’s documented on-device API and unlocks distractions when you have earned it.
At a glance
- You install AnkiDroid and grant AnkiBlock database access.
- You pick apps and websites to block, and how many cards unlock them all for a timed window.
- When a blocked app or site opens, AnkiBlock shows a study gate over it.
- AnkiBlock tracks reviews locally via AnkiDroid’s ContentProvider while you study.
- When you hit your goal, you get a timed unlock for all blocked apps and websites.
AnkiDroid stays your flashcard app
AnkiBlock is not an Anki client. It does not store decks, show card fronts and backs, or run the scheduling algorithm. All of that happens in AnkiDroid’s native reviewer — including images, audio, and LaTeX. If you sync with AnkiWeb, that sync is handled entirely by AnkiDroid, not by AnkiBlock.
AnkiBlock only needs enough information to know which decks you care about, how many cards are due, and whether you have actually studied cards toward your unlock goal.
The on-device API
AnkiDroid exposes a public
Android ContentProvider
backed by
com.ichi2.anki.flashcards. Third-party apps talk to it with
the standard ContentResolver API — the same mechanism
Android uses for contacts or calendar data. Everything happens on your
phone; nothing is sent to AnkiBlock servers (there are none).
The contract is defined in AnkiDroid’s
AnkiDroid API
documentation and
FlashCardsContract. AnkiBlock mirrors those URIs and column names directly instead of
bundling AnkiDroid’s API library, so the app stays lightweight.
Permission
Before AnkiBlock can read your collection, you must grant the
com.ichi2.anki.permission.READ_WRITE_DATABASE permission.
AnkiDroid shows this as a runtime permission dialog. You can revoke it
anytime in Android settings or inside AnkiDroid. Without it, AnkiBlock
can detect that AnkiDroid is installed but cannot list decks or track
study progress.
What AnkiBlock reads
Through the ContentProvider, AnkiBlock queries:
-
Decks (
content://com.ichi2.anki.flashcards/decks) — deck names and live due counts (learning, review, and new), matching what AnkiDroid shows on its home screen. -
Schedule snapshots
(
…/schedule) — which cards are currently queued for study in a deck, identified by note id and card ordinal. This seeds progress tracking when a session starts. -
Card statistics (
…/cards) — per-cardreps,lapses,type,due, and related scheduling fields. AnkiBlock uses these to detect when you have answered a card, not to display card content.
AnkiBlock does not copy note fields, card questions or answers, or media files off the device. It does not submit reviews on your behalf — you press the buttons in AnkiDroid, and AnkiDroid updates its database; AnkiBlock observes the change.
Opening the reviewer
When you tap “Study in AnkiDroid”, AnkiBlock launches AnkiDroid’s
built-in Reviewer activity with the chosen
deckId extra — the same screen you would see if you opened
that deck inside AnkiDroid. You study with AnkiDroid’s full UI: TTS,
gestures, bury/suspend, and whatever add-ons AnkiDroid supports for
review.
Before opening the reviewer, AnkiBlock records a snapshot of the cards currently on that deck’s schedule. That snapshot defines which cards count toward the unlock for this session.
How progress is counted
A background service polls AnkiDroid every few hundred milliseconds while
you are in a study session (or while AnkiDroid is in the foreground
during passive tracking — see below). On each poll it re-reads the
reps and lapses counters for the tracked
cards.
A card counts toward your goal when:
- Its
repscounter increased since the last poll, and - The answer was effectively Hard, Good, or Easy — not Again.
“Again” on a review card increments lapses, which AnkiBlock
treats as not credited. On learning or relearning cards, “Again” often
reschedules the card within a few minutes without bumping lapses; those
short-cycle Agains are ignored too, so only real forward progress
unlocks your apps and sites.
When credited reviews reach your target, AnkiBlock shows a completion overlay (even on top of AnkiDroid) and grants a timed unlock for all blocked apps and websites.
Passive study
If you open AnkiDroid on your own — without going through the study gate — AnkiBlock can still count that work toward your daily study goal, as long as you have granted database access and configured which decks are in scope. The same reps/lapses logic applies; there is no app unlock attached, only daily progress.
Deck scope
You choose which AnkiDroid decks AnkiBlock cares about:
- All decks — every deck’s due cards contribute (like AnkiDroid’s “study all decks”).
- Selected decks (default) — toggle individual decks on or off; counts are aggregated across enabled decks.
- Single deck — one active deck at a time, picked from your AnkiDroid deck list.
Scope preferences are stored locally on your device. Deck listings and due counts always come fresh from AnkiDroid’s provider, so they stay in sync with whatever you changed in AnkiDroid itself.
App and website blocking (separate from AnkiDroid)
Blocking uses Android’s Accessibility service to notice when a blocked app comes to the foreground, and — in supported browsers — to read only the address-bar URL so website rules you configure can be enforced. The study gate is drawn as an accessibility overlay; no “display over other apps” permission is required. Optional Usage Access is used only for screen-time stats in the app picker, not for detecting blocks.
That layer is independent of the AnkiDroid API — it only decides when to ask you to study. The AnkiDroid integration decides whether you have studied enough. An unlock window applies globally to every blocked app and website until it expires.
Privacy summary
- All AnkiDroid reads happen on-device via ContentProvider queries.
- Your collection is not uploaded to AnkiBlock.
- AnkiBlock does not require an account.
- Revoking AnkiDroid database access immediately stops AnkiBlock from reading decks or tracking reviews.
For full details, see the privacy policy.
Not affiliated
AnkiBlock is an independent project. It is not made by, endorsed by, or
affiliated with Anki or AnkiDroid. AnkiDroid
(com.ichi2.anki) must be installed separately from Google
Play or F-Droid.