How it works

AnkiBlock · On-device AnkiDroid integration

AnkiBlock is a study gate for Android: it blocks apps 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 apps when you have earned it.

At a glance

  1. You install AnkiDroid and grant AnkiBlock database access.
  2. You pick which apps to block and how many cards unlock each one.
  3. When a blocked app opens, AnkiBlock sends you to study in AnkiDroid.
  4. AnkiBlock polls AnkiDroid locally to count valid reviews.
  5. When you hit your goal, you get a timed unlock for that app.

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:

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:

“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.

When credited reviews reach your target, AnkiBlock shows a completion overlay (even on top of AnkiDroid) and grants a timed unlock for the blocked app you were trying to open.

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:

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 blocking (separate from AnkiDroid)

Blocking uses Android’s UsageStatsManager to notice when a blocked app comes to the foreground, then routes you to AnkiBlock’s study gate. 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.

Privacy summary

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.