0

I have a Cleaner app in java that has features like - System cleaner, Whatsapp manager, and Basic file Explorer to list & delete files i.e. downloads, images, videos, documents and audio.

Now it has to comply with Google's scoped storage enforcement or it will be removed from the store.

My question here is:

  • How to I make sure I am using correct permissions to comply with this policy? While making sure the older versions of Android would still work as normally (or scoped storage api works with them too?).

What I have already done:

<uses-permission
            android:name="android.permission.WRITE_EXTERNAL_STORAGE"
            android:maxSdkVersion="28" />
        <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
  • I have updated the permissions as shown above^ and set target sdk to 30, as well as removed requestLegacyExternalStorage flag from manifest file.

  • Notice that WRITE_EXTERNAL_STORAGE is using max sdk = 28 tag, do I need to do this with other two (READ&WRITE) permissions also? (official doc only showed example of write-external-storage permission)

  • I'm still asking for these permissions in java code - do I need to wrap that code using if (Build.VERSION.SDK_INT < 30) to make sure it's only asked in lower android versions or using the above tag in manifest already takes care of that for me?

  • I have already implemented the requestDeletePermission() dialog for deleting files in Android 11 - it works! But for listing files in Basic explorer I'm still using the old code that worked in old Android versions - do I need to update that too? (Although it's still working with above 3 permissions)

Please help me I really have to finish it before the end of this month or my app will get removed. The whole point is to avoid violating the new policy in Android 11. I'm willing to give higher bounty to elaborative answers.

Thank you.

Teekam Suthar
  • 529
  • 1
  • 9
  • 20

0 Answers0