Contributor
Farjad Ilyas

"Migrating to Scoped Storage" By Farjad Ilyas, 2021


Mentors
David Allison, Arthur Milchior, Mike Hardy, Mani
Organization
AnkiDroid

This project aims to migrate the AnkiDroid App to Scoped Storage. It will follow Google's recommended approach. This will involve migrating user data from Legacy Directories to those accessible by Scoped Storage. AnkiDroid's users' collections will be migrated to App-Specific Directories. Media will be stored in their respective Scoped Storage collections. Two migration mechanisms will be developed:

  1. For targetSdk <= 29: Using WRITE_EXTERNAL_STORAGE permission
  2. For targetSdk >= 30: Using permission granted by user via System File Picker

This will ensure the data of users who update at any time will be migrated.

Moreover, this project aims to support all AnkiDroid features under Scoped Storage. It will ensure support for Import, Sync, AnkiDroidAPI client apps, opting for external storage & preserving data post-uninstallation. Scoped Storage inevitably forced some changes in app behavior like the need for migration itself & user data being deleted upon uninstallation. This project will enable a smooth transition by providing a short introduction to these changes.