如何在 android 11 范围存储中为 WhatsApp 状态保护应用程序使用 .status 文件夹?

How to use .status folder for WhatsApp status saver app in android 11 scoped storage?

大家好,我制作了一个 WhatsApp 状态保护程序。但是在 android 11 中,Google 引入了分区存储,所以我无法在应用程序中获取用户状态。为此,我使用了 MANAGE_EXTERNAL_STORAGE,但我无法在 Google 播放中发布该应用程序。我见过很少有应用程序使用某些权限来授予访问权限以使用该 .status 文件夹。怎么做 ?我附上了应用程序要求的权限的屏幕截图。我是初学者所以请帮助我。

请求用户授予 WhatsApp 状态存储文件夹的权限。

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);
}

您可以在此处查看使用上述方法的工作示例。 https://play.google.com/store/apps/details?id=com.larntech.whatsappstatussaver