![](/img/trans.png)
[英]How to access Whatsapp folder of Android 11 by using MediaStore API?
[英]How to get specific folder like WhatsApp (.Status) folder in android 11 using MediaStore Api in android studio
這是在 android 11 中獲取特定路徑的代碼,但不幸的是,我在 android 工作室中得到了類似 /WhatsApp/Media/.Statuses 的路徑
{
Uri=collection
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
collection = MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL);
} else {
collection = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
}
String selection=MediaStore.Video.Media.DATA +" like?";
String[] selectionArgs=new String[]{"%/WhatsApp/Media/.Statuses%"};
String[] parameters = new String[0];
Cursor cursor = getApplicationContext().getContentResolver().query(
collection,projection,selection,selectionArgs, sortOrder)}
val STATUS_DIRECTORY = File("/storage/emulated/0/Android/media/com.whatsapp/WhatsApp/Media/.Statuses")
使用它來獲取什么是應用程序狀態
在 android 11 和 12 中,當您獲得特定文件夾時,您只能使用存儲訪問框架權限,即運行時權限
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.