With the recent Google Play ruling which have to remove the legacy storage access if targeting 11+.
I couldn't find a way for cross-profile to work.
My current code works just fine using the legacy storage access - able to pick media from work profile to personal profile.
When I remove the android:requestLegacyExternalStorage=true from AndroidManifest.xml, my current codebase is no longer able to see media from the personal profile.
My current intent is as simple as follow which works if within same profile but not for cross-profile.
My question is: What am I missing in order to make it work? The code snippet posted below works fine within same profile. But the moment it goes cross-profile, it stops working.
Devices used: Xiaomi Pocophone F1, Samsung Galaxy A51
val intent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
activity.startActivityForResult(Intent.createChooser(intent, "Add From Gallery"), 100)