简体   繁体   English

如何访问 android 11(范围存储)中的 whatsapp/media 目录?

[英]How can I access whatsapp/media directory in android 11 (Scoped storage)?

I have an app that access status folder in whatsapp/media directory.我有一个应用程序可以访问 whatsapp/media 目录中的状态文件夹。

But on android 11 my app is not working due to android 11 scoped storage.但是在 android 11 上,由于 android 11 范围存储,我的应用程序无法运行。

Is there a way to access statuses folder in whatsapp/media directory?有没有办法访问 whatsapp/media 目录中的 statuses 文件夹?

In Android 11 the path has changed to /Android/media/com.whatsapp/WhatsApp/media在 Android 11 中,路径已更改为 /Android/media/com.whatsapp/WhatsApp/media

I think it might be work.我认为这可能是工作。

String mString=  Build.VERSION.SDK_INT<=30  ? "WhatsApp/Media/.Statuses":"Android/media/com.whatsapp/WhatsApp/Media/.Statuses";

Google Play changed their policy in All file access permission. Google Play 更改了所有文件访问权限的政策。

Here I mentioned below the github link where he used file access for Whatsapp status Downloader but the problem is if you publish it on playstore means it won't work they will reject your app so you can find the solution for that.在这里,我在下面提到了 github 链接,他在该链接中使用了 Whatsapp 状态下载器的文件访问权限,但问题是,如果您在 Playstore 上发布它意味着它不起作用,他们将拒绝您的应用程序,因此您可以找到解决方案。 https://github.com/GauthamAsir/WhatsApp_Status_Saver https://github.com/GauthamAsir/WhatsApp_Status_Saver

I have been able to solve this problem by downgrading the target SDK version to "29"我已经能够通过将目标 SDK 版本降级为“29”来解决这个问题

Here is what you need to do:这是您需要做的:

1- In the Android Manifest file write 1- 在 Android 清单文件中写入

...
 <application
        android:requestLegacyExternalStorage="true"
...

2- In app-level build.grade file put target SDK equal to "29". 2- 在应用程序级 build.grade 文件中将目标 SDK 设置为“29”。 Add the following program in build.grade file:在 build.grade 文件中添加以下程序:

...
android {
  defaultConfig {
    minSdkVersion 19
    targetSdkVersion 29
  }
}
...

Also, note that targetSdkVersion 30 will cause android:requestLegacyExternalStorage="true" to be ignored, so we have to downgrade it to 29 (Android 10) for this thing to work另外,请注意 targetSdkVersion 30 将导致 android:requestLegacyExternalStorage="true" 被忽略,因此我们必须将其降级为 29(Android 10)才能使此功能正常工作

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 b4a 在 android 11(范围存储)中获得“所有文件访问”或“对文件夹的永久和完全访问”? - How can i get “All files access” or “Permanent and complete access to a folder” in android 11 (Scoped Storage) with b4a? whatsapp 是否允许在 android 11 范围存储上获取用户状态? - would whatsapp allow getting users statuses on android 11 scoped storage? Xamarin.Forms - 如何为 android 定义范围存储以及如何实现它以在下载目录中下载文件? - Xamarin.Forms - How to define scoped storage for android and how can I implement it to downlaod files in Downloads directory? Android 范围存储 - 如何自定义目录选择器 - Android scoped storage - how to customize directory picker Android 11 未在应用程序中显示 WhatsApp 状态。 /storage/emulated/0/WhatsApp/Media/.Statuses/ 文件夹显示空结果 - Android 11 not showing WhatsApp status in app. /storage/emulated/0/WhatsApp/Media/.Statuses/ folder shows empty result Android 11 范围存储权限 - Android 11 Scoped storage permissions 安卓 11 | 范围存储强制执行 - Android 11 | Scoped storage enforcement 如何访问 Whatsapp Android 11 的.Statuses 文件夹? - How to access .Statuses folder of Whatsapp Android 11? 如何从范围存储中打开 android 11 中的 Pdf - How to open Pdf in android 11 from scoped storage Android 11 范围存储如何存储视频和gif - Android 11 scoped storage how to store videos and gif
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM