1

I am working on an application which shows the list of whatsapp status in the app. Now my questions it that after the scoped storage we can't access that specific path so what to do now? Or all the whatsapp status saver applications won't work in future? Right now i am access the statuses folder like this.

        String whatsappStatus = (Environment.getExternalStorageDirectory().getAbsolutePath() + "/WhatsApp/Media/.Statuses");

But it is not working on android 11 of course.If i use

All files access

to access all files on phone google play don't allow it unless it's the last solution which is not the case here.

Is there any hope that whatsapp would store the status in public directly in future or they would allow access to that specific directly?

3 Answers3

0
private void checkWhatsAppPermission(){
    // Choose a directory using the system's file picker.
    Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
    // Optionally, specify a URI for the directory that should be opened in
    // the system file picker when it loads.

    Uri wa_status_uri = Uri.parse("content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fmedia/document/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2FMedia%2F.Statuses");
    intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, wa_status_uri);
    startActivityForResult(intent, 10001);
}

You can check a working example here. https://play.google.com/store/apps/details?id=com.larntech.whatsappstatussaver

Richard Kamere
  • 749
  • 12
  • 10
0

You should use runtime permission which is storage access framework permission read documents

Choose a directory using the system's file picker.

Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
Uri wa_status_uri = Uri.parse("content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fmedia/document/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2FMedia%2F.Statuses");
intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, wa_status_uri);
startActivityForResult(intent, 10001);
Jitesh Prajapati
  • 2,533
  • 4
  • 29
  • 51
-2

new path

String whatsappStatus = (Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/media/com.whatsapp/WhatsApp/Media/.Statuses");

and put one condition like this

if (android.os.Build.VERSION.SDK_INT < 30) {
 String whatsappStatus = (Environment.getExternalStorageDirectory().getAbsolutePath() + "/WhatsApp/Media/.Statuses");
}else {
String whatsappStatus = (Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/media/com.whatsapp/WhatsApp/Media/.Statuses");
}
  • Your given code will not work if i am targeting SDK 30, because you will need All files access permission which google play don't suggest. – Unique Identifier May 31 '21 at 00:57
  • https://stackoverflow.com/questions/65934372/android-11-not-showing-whatsapp-status-in-app-storage-emulated-0-whatsapp-medi/67705016#67705016 – Darshan Sutariya Aug 13 '21 at 04:28