rosuH / AndroidFilePicker

FilePicker is a small and fast file selector library that is constantly evolving with the goal of rapid integration, high customization, and configurability~
https://afp.rosuh.me
MIT License
991 stars 87 forks source link

How to show PDF files? #152

Closed amanzan closed 2 years ago

amanzan commented 3 years ago

I have PDF files downloaded in my device, but AndroidFilePicker does not show them, so I cannot select them. How can I do this?

rosuH commented 3 years ago

Did other files show normally?

mouness2020 commented 3 years ago

it's seems all documents files not show , other files like mp3 mp4 mov works fine

FilePickerManager .from(this) .storageType( getString(R.string.select_) , FilePickerConfig.STORAGE_CUSTOM_ROOT_PATH) .enableSingleChoice() .maxSelectable(1) //.filter(aFilter) .showHiddenFiles(false) .forResult(FilePickerManager.REQUEST_CODE); IMG_0678 IMG_0679 IMG_0677

rosuH commented 3 years ago

The above code is all your codes in the project? If not, just post all of them.

mouness2020 commented 3 years ago

yes it's all code, and tested in these configs compileSdkVersion 30 minSdkVersion 21 targetSdkVersion 30

Phone: Redmi note 9- android 11

rosuH commented 3 years ago

Could you list download folder manually by File.listfiles ?

Toprakete commented 3 years ago

Same here on Realme7 with Android 11 FilePickerManager.from(ProjectLoaderActivity.this).enableSingleChoice().forResult(FilePickerManager.REQUEST_CODE);

Solved: Add to Manifest; <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> Ask user for permission with:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
            if (!Environment.isExternalStorageManager()) {
                Uri uri = Uri.parse("package:${BuildConfig.APPLICATION_ID}");
                Intent inte = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION,uri);
                startActivity(inte);
             }
}
rosuH commented 2 years ago

@Toprakete Do not recommend Using MANAGE_EXTERNAL_STORAGE permission. Google Play would conduct special review.

Toprakete commented 2 years ago

@rosuH Yes, but that's ok, nothing to hide. As in https://developer.android.com/training/data-storage/manage-all-files to read, for 'On-device file search' it's ok to use this, I think

rosuH commented 2 years ago

This issue has been confirmed, on Android 11 platforms, the application READ_EXTERNAL_STORAGE can only read media files, but document types and binary files will be ignored. Thank you for your feedback!