Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue : Need to use Media Store Api or No Access to Files - Google Play Console Rejection when target sdk was 30

Hi Programming fellas

I have uploaded our apk to google play console but they have rejected our apk and mentioning use Media Store Api for camera and gallery.

My App has already implemented and use WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE permission and work fine on all android version

The problem arise when I changed target sdk to 30 and submit app.These are the permission which I used for READ WRITE operation.

 <uses-permission
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    android:maxSdkVersion="29"
    />
 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

I have attached screen shot of rejection from google play too.Previously I have tried to use MANAGE_EXTERNAL_STORAGE permission but still our app was rejected

If any body encounter with this issue kindly post a solution for this

Thanks ...

Play Console Rejection

Play Console Rejection

like image 607
Sharjeel Ahmad Siddiqui Avatar asked Jan 24 '26 02:01

Sharjeel Ahmad Siddiqui


1 Answers

In Android 11, the way to access external storage has changed a bit.

Source: Storage updates in Android 11

In my case, I've solved my problem like this:

  1. I added file_path.xml in path src/main/res/xml

    FilePath

  2. I've used getExternalFilesDir for get file in the device storage.

Before:

val mPath = Environment.getExternalStorageDirectory().toString() + "/Ticket_" + date + ".jpeg"

After:

 val mPath = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES).toString() + "/Ticket_" + date + ".jpeg"

I hope help you :)

like image 67
Richard Joel Avatar answered Jan 26 '26 16:01

Richard Joel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!