Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
772 views
in Technique[技术] by (71.8m points)

react native - Android 11 not showing WhatsApp status in app. /storage/emulated/0/WhatsApp/Media/.Statuses/ folder shows empty result

I have facing issue related to Android 11 in React Native. In my app, i am fetching WhatsApp status from /storage/emulated/0/WhatsApp/Media/.Statuses/ folder everything working find till Android 10, but in android 11 it shows nothing. Please guild me for this.

Here is my react native code to read WhatsApp status folder

  var RNFS = require('react-native-fs');
        RNFS.readDir(RNFS.ExternalStorageDirectoryPath + '/WhatsApp/Media/.Statuses/').then((result) => {
             printLogs("Result=>", result);
             result.map((item)=>{
                 printLogs("path===>",item.path)
             })
            setStatusList(result.sort((a, b) => a.mtime < b.mtime ? 1 : -1));
            setRefresh(false);

        }).catch((error) => {
            printLogs("error=>", error);
            setRefresh(false);
            setStatusList([]);

        })
question from:https://stackoverflow.com/questions/65934372/android-11-not-showing-whatsapp-status-in-app-storage-emulated-0-whatsapp-medi

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

On an Android 11 device your app has access to the folder you mention but it will not see files that belong to other apps. Only subfolders.

So the owner of the file is important on an Android 11 device.

For testing at home you can request all files access with MANAGE_EXTERNAL_STORAGE.

See: Accessing external storage in Android API 29


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...