I am developing an android application that creates and opens specific file types. I am using Storage Access Framework to access files for Kitkat or above operating system. Now I need to open .enc
files and filter out any other files. Using Storage Access Framework I tried:
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("file/enc");
and
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType(".enc");
but none of them working. Help me please.
Android 4.4 (API level 19) introduces the Storage Access Framework (SAF). The SAF enables users to browse and open documents, images, and other files across all their preferred document storage providers. A standard UI lets users browse files and access them in a consistent way across apps and providers.
Now I need to open .enc files and filter out any other files
That is not possible, sorry.
Besides, there is nothing stopping the user or other software from having a perfectly valid file that just happens to not have .enc
as the file extension, because perhaps the content is not represented as a file. For example, this Web page is in HTML but the URL does not end in .html
.
Instead, allow the user to pick anything, then validate the resulting selection to see if it seems to be well-constructed for whatever file format you are expecting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With