Handling Files in Code After Android 10 Released

The new ways of working with files in your Android apps targeting Android 10

M.N Emmanuel
AndroidPub

--

Icon Made for this Article

With the release of Android 10 (API level 29 or Q), a lot of things have changed in the Android SDK especially security-wise which is a good thing but being something that keeps evolving. there are always pros and cons to each evolutionary stage and it so happened that this time the cons were met with a lot of controversies by developers. The Scoped Storage in android 10 forces developers to use the Storage Access Framework for almost all operations on user files in disregard to the java.io.file API for it not being very secure. This led to a long list of already published apps that relied on the java.io.file API to migrate.

With Scoped Storage, things are both more restrictive and easy at the same time. A compatible app is given an app-specific folder for user-facing data. Apps have a private sand-boxed folder for storage of their required files and this is unavailable to any other app. Scoped Storage gives the ability to create a second folder for files the app creates, we shall see how this is done using the Document provider API in the sections which follow

In the following sections, we will see how storage can be accessed with the right permissions and implementations, we will…

--

--

M.N Emmanuel
AndroidPub

Full stack Mobile Developer, with tech stack, Android, Kotlin, java, React, React Native, Flutter, Dart, C# Xamarin.