Welcome Contributors!
AnkiDroid Companion is an open-source project that welcomes contributions from the community. Whether you’re fixing bugs, adding features, improving documentation, or suggesting enhancements, your help is appreciated!Getting Started
Prerequisites
Before you begin, ensure you have:- Android Studio (latest stable version recommended)
- JDK 8 or higher
- Android SDK with API level 26+ (Android 8.0 Oreo)
- Git for version control
- AnkiDroid installed on a test device or emulator
Development Setup
-
Clone the repository:
-
Open in Android Studio:
- Launch Android Studio
- Select “Open an Existing Project”
- Navigate to the cloned repository
- Wait for Gradle sync to complete
-
Configure AnkiDroid on your test device:
- Install AnkiDroid from Google Play or F-Droid
- Create at least one deck with some cards
- Ensure AnkiDroid’s API is enabled (it’s enabled by default)
-
Build and run:
Or use Android Studio’s “Run” button (Shift+F10)
-
Grant permissions:
When you first launch the app, it will request the
READ_WRITE_DATABASEpermission. Grant this to allow API access.
Project Structure
Build Configuration
Frombuild.gradle.kts:6-50:
The app targets Android 8.0 (API 26) and above, which covers ~95% of active Android devices as of 2024.
Development Workflow
Making Changes
-
Create a feature branch:
Or for bug fixes:
-
Make your changes:
- Write clean, readable code
- Follow existing code style
- Add comments for complex logic
- Test thoroughly on a real device
-
Test your changes:
- Run the app on a physical device (emulator may have permission issues)
- Test with different deck configurations
- Verify notifications appear correctly
- Test background worker behavior
- Check that card reviews sync to AnkiDroid
-
Commit your changes:
Write clear commit messages:
- Use present tense (“Add feature” not “Added feature”)
- Be concise but descriptive
- Reference issue numbers if applicable
-
Push to your fork:
Submitting a Pull Request
- Push your branch to GitHub
- Open a pull request on the main repository
-
Describe your changes:
- What problem does this solve?
- How did you test it?
- Are there any breaking changes?
- Screenshots/videos if UI changes
-
Wait for review:
- Maintainers will review your PR
- Address any requested changes
- Be patient and responsive to feedback
Code Style Guidelines
- Kotlin: Follow Kotlin coding conventions
- Java: Follow Google Java Style Guide
- Indentation: 4 spaces (already configured in project)
- Naming:
- Classes:
PascalCase - Functions/variables:
camelCase - Constants:
UPPER_SNAKE_CASE
- Classes:
Known Limitations & Improvement Opportunities
FromREADME.md:36-44, here are areas that need improvement:
1. Minimalistic Card Support
Current Limitation: The app only supports simple cards with plain text. Complex HTML, images, audio, and formatting are not rendered. Code Location:Notifications.kt:28-40
Current Implementation:
- Render HTML in a WebView within the notification
- Support image display in expanded notifications
- Add audio playback buttons for cards with sound
- Handle cloze deletions properly
- Support LaTeX/MathJax rendering
2. Skipping Cards
Current Limitation: No way to skip a card without answering it. Improvement Ideas:- Add a fifth “Skip” button to notifications
- Implement card burial (hide until next day)
- Add “Suspend” option to remove card from rotation
Notifications.kt:49-52 to add a skip button:
NotificationReceiver.kt:14-19:
3. New Study Interval
Current Limitation: Hard-coded 8-hour interval for checking new cards. Code Location:MainActivity.kt:47-50
- Add a settings screen
- Allow users to configure check interval (1-24 hours)
- Store preference in SharedPreferences
- Update worker when preference changes
4. Embedded Strings
Current Limitation: Many strings are hard-coded in the code instead of inres/values/strings.xml.
Examples:
res/values/strings.xml:
5. Future Features
FromREADME.md:16:
Planned Expansions:
- Home screen widget: Quick access to study without opening notification shade
- Lock screen widget: Study while phone is locked
- Statistics view: Track daily/weekly review counts
- Multiple deck support: Rotate between multiple decks
- Custom notification layouts: User-configurable button labels and colors
Reporting Issues
Before Opening an Issue
- Search existing issues to avoid duplicates
- Update AnkiDroid to the latest version
- Check if permissions are granted in Android settings
- Test on a physical device (emulators may behave differently)
Opening a Bug Report
Include:- Device information: Make, model, Android version
- AnkiDroid version: Check in AnkiDroid’s About screen
- App version: Check in app settings or build.gradle.kts
- Steps to reproduce: Detailed steps to trigger the bug
- Expected behavior: What should happen
- Actual behavior: What actually happens
- Logs: Use
adb logcatto capture relevant logs - Screenshots/videos: If applicable
Opening a Feature Request
Describe:- What feature you’d like to see
- Why it would be useful: Use cases, user stories
- How it might work: Proposed UI/UX or implementation
- Related features: Similar apps or AnkiDroid features
Testing
Manual Testing Checklist
Before submitting a PR, test these scenarios:- App launches successfully
- Permission request appears on first launch
- Deck list populates correctly
- Clicking “Refresh” shows notification
- Notification displays question and answer
- All four buttons work (Again, Hard, Good, Easy)
- Next card appears after answering
- Completion notification shows when deck is finished
- Periodic worker runs after 8 hours (test by changing interval)
- App works after device restart
- State persists across app restarts
- Works with renamed decks
- Works with multiple decks (switching between them)
Testing with ADB
View logs:License
FromREADME.md:52-54:
This project is licensed under the MIT License. By contributing, you agree that your contributions will be licensed under the same license.
Getting Help
If you need help:- Check existing documentation in this wiki
- Read the source code: It’s well-commented
- Open a discussion: For questions about implementation
- Ask in issues: Tag with “question” label
Recognition
Contributors will be:- Listed in the GitHub contributors page
- Mentioned in release notes for significant contributions
- Thanked in the project README
Thank you for contributing to AnkiDroid Companion! Every improvement, no matter how small, makes the app better for everyone. Happy coding!