Restrict user to upload file from downloads folder only - java

Is there any way in which we can restrict the user to upload files (PDF, Docx and Images) from downloads folder only? Like he can't see any other directory from he can choose a file from? Actually I have made an app in which pdf files are not getting the right path for WhatsApp Documents and docs in Recents folder on android 11 I have tried many solutions but nothing helped. So I am thinking if we can restrict the user to Downloads only?

Related

Create .nomedia file in External Storage and hide media files in android 11 and above

I have a chat app where users share images/video/audio etc. I need organized my directory structure, where i need to keep sent files in separate sub-folder and hide it from gallery apps but user can able to locate with file manager apps.
The only things comes in my mind that create .nomedia file in sent folders but in android 11+ we can't create files just like that. Our users gallery apps messed up with sent and receive images, I am not able to find any solution on StackOverFlow and on other documentations or google search.
On Android 11+ i am using MediaStore to read and write media files. Anyone have any idea how can i create .nomedia files in External Storage like Pictures/Movies/Documents etc.
I am creating .nomedia below andoird 10 like this but i have no idea how to create in android 11+
File file = new File(dir+".nomedia");
file.createNewFile();

How to open a programmatically protected PDF file [Not password protected]

There is a android app named taaghche which you can purchase and read pdf books etc...
I purchased a book and I want to be able to read it on PC not android, and also be able to highlight the text (which is not allowed in the app), But The app stores the pdfs so that the pdf files only opens in the app itself and if you try to open the pdf in another device you'll get the error:
Note that the app actually stores the pdf along with a file with no extension and the same name.
I think the app uses the file with no extension to give permission to the pdf file to be opened.
Here is the two files in a zip to download and have a look.
http://langfox.ir/download/pdfs.zip
Any idea or solution or clue to open this file is greatly appreciated.
The pdf looks encoded/encrypted (I maybe wrong) but I would expect to see a Pdf header, and I don't.
The file without an extension is a JFIF file (JPEG File Interchange Format), if you change the extension to Jpg, or JFIF, you should be able to view it as an image. Or in C# you can just use the Bitmap or Image class to load it
Image.FromFile(theFileName);

Android Print Manager - return saved pdf file path

Using Android PrintManager API user can save content as PDF into device's internal/external directory.
I need to get that PDF file's path as soon as it is created. Is there any way to do this directly without having to use a file chooser?
Any ideas are appreciated.
Using Android PrintManager API we can save content as PDF into device's internal/external directory.
No. The user can elect to send your print job to a PDF file that is stored locally. The user could elect to do something else:
Send it to an actual printer
Send it to something else (e.g., Cloud Print)
Abandon the print job
Is there any way to do this directly without having to use a file chooser?
No, simply because there is no requirement for the user to save the content to a local PDF file in a place that you can access. In addition to all the above non-PDF alternatives, the user could save it as a PDF to removable storage, in a directory that your app cannot access.
I need to get that PDF file's path as soon as it is created
Then the PrintManager API is not suitable. Generate a PDF some other way (e.g., iText).

How can I open doc and ppt files without any app installed in device in Android?

How can I open doc, ppt files without any app installed in device in Android?
I am developing a document to go and I would like suggestions on how can I open doc, ppt, pdf file without any app installed.
if you want a readable output for those files, you kinda need another app. To my knowledge, stock android doesnt have a way to read any of those files nativly.
if you can manage one app, kingston office i know personally can open those types(pdf is iffy)
https://play.google.com/store/apps/details?id=cn.wps.moffice_eng&hl=en
The other way i think is if you had an external interpreter that can make a web page out of it. Maybe using drive.google.com would serve for that, but i dont know how far the browser on your device can go with it.

Android - How to package documents into an app

I'm trying to create an app and have the ability to save files to /data/data/(packagename)/files or a directory similar to that. The goal would be to have a pdf or doc handler, as necessary, open the files stored on the internal storage and be viewed by the user. I have the code to get a pdf reader that is installed and display the file but I do not know how to package the files so they are installed in a directory like the one above. Also, if I am able to do this would I use getResources to access the files? How should the file structure look in eclipse to make this happen on install of the APK?
I do prefer to have the files stored internally (they are small) and not on the SD card.
I admit I am new to this and am trying to learn as I go. Thanks for the help!
As I understand your approach you only need to place your files to assets folder of your application and then just copy them to the internal storage. Read more here.

Categories

Resources