When Android 10 was released, it came with a concept called scoped storage, and Google hinted that Android 11 will require all apps – existing and new – to use Scoped Storage. Developers still have time until the end of 2021 to adopt the new change that helps protect apps and data on external storage. But Viber – instant messaging app, has made the migration in order to better protect the app and user data on platform level, setting the tone for other applications to follow eventually.

Almost all apps, including Viber, at their individual levels – “store, process and share a significant amount of data” to provide users a seamless, quick and secure operation. Until now the apps in a device had some private and shared storage, which was accessed by other apps though permissions – scoped storage alters how apps store and access files on device’s external storage.

To migrate the app experience to scoped storage, Viber uses MediaStore API making the public media files now accessible in the device’s gallery. These can be accessed by other apps with storage permission. The private media files on the other hand are stored in app-specific directory on external storage and are accessible through the internal ContentProvider.

In scoped storage, Viber gets unrestricted access to its app-specific directories on external storage. Viber stores media files on its own top-level directory for Android 10 or lower, storing media files not exposed to device’s gallery app. For Android 11 and higher, the directory is set to read-only mode. In Android 11 for Viber to access non-media documents created by other apps now, it will use Storage Access Framework because update storage runtime permission provides access only to images, audio files, and videos.

With scoped storage the app-specific directories on the external storage are not accessible directly by other apps – external storage is thus secure and can be used by the apps – in this case Viber – for storing private user files. To leverage this better protection of app and user data, more developers like Viber are migrating their version of the app that targets Android 11 to comply with scoped storage best practices.