How to save screenshots not to “App-specific storage” but to “Shared storage” on apps that target Android 10 (Android Q, API 29) or higher using utils::captureScreen.

I want to use utils::captureScreen to save screenshots of my Android game which is targeted Android 10.

Also I want to save these screenshots, not to "App-specific storage” but to “Shared storage”, so that users can access these screenshots from other apps.

If I use utils::captureScreen on apps that target Android 10 with Shared storage file path, it always fails.

The reason is related to the article below.
https://developer.android.com/about/versions/10/privacy/changes#scoped-storage

If I add a line

android:requestLegacyExternalStorage="true"

in the application tag on AndroidManifest.xml, it works, but it will not support on apps that target Android 11.

Does anyone have any good idea to support utils::captureScreen on apps that target Android 10 (Android Q, API 29) or higher perfectly.

Thank you.