You may need to change how your app uses the File component. See What this means for App Inventor Applications for details.
Read on to learn more about the specifics of why these changes are needed.
Early Android devices (and some still today) have both “internal” and “external” storage. The external storage was often a “Secure Digital” (or SD) card. On devices without a physical SD Card, it is often emulated.
Traditionally the SD Card is referenced via the file path “/sdcard” for consistency. For the rest of this blog post, we’ll call the SD Card (or its emulated version) just “external storage.”
External storage is shared among all applications on a device. So one application can write a file in external storage and another unrelated application can read (or even overwrite) that file.
Many devices have a lot more external storage than “internal” or “private” storage. So many applications store files in external storage to have access to more storage, not because they want other applications to be able to access their files.
This has created a privacy problem on Android as not all applications
are well-behaved and respect user privacy. To address this back in
2016 Google added the requirement that any application that wants to
read external storage had to declare the
permission. Similarly, applications wishing to write into external
storage need the
WRITE_EXTERNAL_STORAGE permission. More recent
versions of Android even require the end user to “approve” the use of
Unfortunately most people do not understand the privacy implications of granting these permissions, so privacy problems remain. Starting with Android version 10, Google is migrating to a stricter approach.
The new stricter approach involves having each application write to a reserved private area of external storage. So different applications can no longer read or write the data of other applications on the device. Because this may result in applications losing access to files they already stored, Google permits a way around this new restriction in Android 10. This is so application authors can release new versions of their applications that can move the files they care about into the locations they will be allowed to use now and in the future. Google intends to disable this “back door” with Android version 11.
If your application does not use the File component, then this change will not affect you.
Starting with release nb184, MIT App Inventor packaged applications are designed for Android 10. This is a Google requirement if MIT App Inventor applications are to be permitted in the Google Play Store as of August 1, 2020. So making the change described below was not an option for MIT App Inventor if we wanted to preserve the ability of people to put their applications in the Google Play Store.
In App Inventor, the File component is the primary means of interacting with files on the system. Filenames come in three flavors in App Inventor:
It is only case 2, filenames that begin with a slash /, that are affected by this change. Prior to release nb184, if you referenced a file starting with a slash, say for example /hello.txt the file was placed on the device in /sdcard/hello.txt. After the release this filename will not reference /sdcard/hello.txt but instead will reference a file inside the storage reserved for the application.
Unfortunately, this results in some applications developers losing access to files written with previous versions of their applications on Android 10 (those packaged in versions of MIT App Inventor before release nb184). We apologize for the abrupt change. To mitigate the situation, we will be releasing MIT App Inventor version nb184a. It will contain a new flag for the File component, LegacyMode that when set will cause the File component to behave as it had before release nb184.
We recommend that applications only use this flag to copy files from their prior location directly inside /sdcard to the new reserved location as after Android 11 this flag will be blocked from working by Google.