I've an WhatsApp Status Saver app and want to update it cause WhatsApp changed the path. The path I want to access is:
/sdcard/Android/media/com.whatsapp/WhatsApp/Media/.Statuses/
Unfortunately Google changed permissions when it comes to Storage Access.
Is there any way to access the folder with the Mediastore API or the Storage Access Framework?
I tried this with the Storage Access Framework (https://developer.android.com/training/data-storage/shared/documents-files):
Code:
openDirectory(Uri.fromFile("/sdcard/Android/media/com.whatsapp/WhatsApp/Media/.Statuses/"));
public void openDirectory(Uri uriToLoad) {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, uriToLoad);
startActivityForResult(intent, 1);
}
@Override
public void onActivityResult(int requestCode, int resultCode,Intent resultData) {
if (requestCode == 1 && resultCode == Activity.RESULT_OK) {
Uri uri = null;
if (resultData != null) {
uri = resultData.getData();
}
}
}
Normally it should open the path to grant permissions but that doesn't work, it opens the last directory. Also it's not possible to select the folder manual because it's hidden.
Thanks