0

I am trying to test scoped storage in my app and I need to be able to toggle scoped storage on and off for testing. According to the development documentation:

To enable scoped storage in your app, regardless of your app's target SDK version and manifest flag values, enable the following app compatibility flags:

DEFAULT_SCOPED_STORAGE (enabled for all apps by default) FORCE_ENABLE_SCOPED_STORAGE (disabled for all apps by default)

Important: When toggling this change off for app testing, you must also disable FORCE_ENABLE_SCOPED_STORAGE (if it is not already disabled) to restore the legacy storage behavior.

I am able to toggle FORCE_ENABLE_SCOPED_STORAGE in the phone's Developer Settings, but the DEFAULT_SCOPED_STORAGE item is disabled and cannot be toggled. How do I toggle it? Both switches must be set to the off position to disable scoped storage for testing.

user1608385
  • 609
  • 8
  • 17

2 Answers2

0

I dont know those flags and they come quite unhandy as you have to recompile your app.

Better read answer at Accessing external storage in Android API 29

Then the user of your app can toggle it on/off.

blackapps
  • 8,011
  • 2
  • 11
  • 25
  • The Android documentation encourages developers to make use of those flags for development. They are hidden pretty well deep in the developer settings and it is not something the average android user will ever access. – user1608385 Dec 12 '20 at 21:14
0

I have not had too much luck toggling the compatibility flags in the developer screen. However, another way toggle the forced scoped storage is to change between targetSdkVersion 29 and targetSdkVersion 30

Jason
  • 413
  • 5
  • 11