First Launch
When you first launch AnkiDroid Companion, the app performs several checks to ensure it can communicate with AnkiDroid and display notifications properly.
Automatic Setup Flow
The app’s setup process is handled by the MainActivity class, which automatically:
- Creates a notification channel for displaying card notifications
- Checks if AnkiDroid API is available
- Requests necessary permissions
- Loads your deck list from AnkiDroid
Here’s how the setup verification works:
private fun setup() {
// Api is not available, either AnkiDroid is not installed or API is disabled.
if (!AnkiDroidHelper.isApiAvailable(this)) {
explainError("API is not available!\n" +
"This means either AnkiDroid is not installed or API is disabled from the AnkiDroid app")
} else {
mAnkiDroid = AnkiDroidHelper(this)
if (mAnkiDroid.shouldRequestPermission()) {
explainError("AnkiDroid Read Write permission is not granted, please make sure that it is given!")
mAnkiDroid.requestPermission(this, 0)
} else {
startApp()
}
}
}
Source: ~/workspace/source/app/src/main/java/com/ankidroid/companion/MainActivity.kt:58-73
Permission Requests
AnkiDroid Companion requires specific permissions to function. Denying these permissions will prevent the app from working properly.
AnkiDroid API Access
The first permission you’ll encounter is AnkiDroid Read/Write Permission. This permission allows AnkiDroid Companion to:
- Read your deck list
- Access card information
- Query scheduled cards
- Interact with AnkiDroid’s review system
Permission prompt appears
When you first launch the app, you’ll see a system dialog requesting permission to access AnkiDroid.
Grant permission
Tap Allow or Grant to give AnkiDroid Companion access to AnkiDroid’s API.
Verification
If permission is granted successfully, the app will load your deck list. If denied, you’ll see an error message explaining that the permission is required.
If you accidentally denied the permission, you can grant it later through Android’s app settings under Permissions.
Notification Permission
AnkiDroid Companion uses notifications as its primary interface for card review.
The notification channel is created automatically when the app launches with the name “AnkiNotificationChannel”.
Enabling Notifications in Android Settings
For the app to work properly, notifications must be enabled at the system level:
Open Android Settings
Navigate to your device’s Settings app.
Find Apps & Notifications
Look for Apps, Applications, or Apps & notifications (varies by device).
Locate AnkiDroid Companion
Find and tap on AnkiDroid Companion in your app list.
Enable notifications
Tap on Notifications and ensure they are enabled. Make sure the notification channel is set to a priority level that allows persistent notifications.
Battery optimization may interfere with notifications. Some Android devices aggressively limit background apps. If you don’t receive notifications when expected, you may need to disable battery optimization for AnkiDroid Companion in your device settings.
Troubleshooting Setup Issues
API Not Available Error
If you see the message “API is not available!”, this means:
- AnkiDroid is not installed on your device, or
- AnkiDroid’s API is disabled in its settings
Solution: Open AnkiDroid and ensure the app works properly. Check AnkiDroid’s settings to verify that the API is enabled.
Permission Not Granted Error
If the permission request fails:
- Go to your device’s Settings → Apps → AnkiDroid Companion
- Tap on Permissions
- Manually grant the required permissions
- Restart AnkiDroid Companion
Next Steps
Once setup is complete, you’re ready to start using the app! Proceed to the Quick Start Guide to learn how to select a deck and receive your first notification.