Hello,
just one little doubt will the solution (Permissions. Photos) work for previous android versions.?
For Android permissions, you need to apply for different permissions according to different versions.
Please refer to the following steps:
Step 1. Modify Platforms/Android/AndroidManifest.xml in your project:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
<!-- Required only if your app needs to access images or photos that other apps created -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<!-- Required only if your app needs to access videos that other apps created -->
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<!-- Required only if your app needs to access audio files that other apps created -->
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
Step 2. When requesting permissions, you could request the corresponding permissions by judging the Android version.
#if ANDROID
if (Build.VERSION.SdkInt >= BuildVersionCodes.Tiramisu) // Check whether the Android version is Android 13 or later
{
// request media permissions
}
else
{
// request stroage permissions.
}
#endif
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.