Android Question PDF FILE PROVIDER B4X

Uniko Sistemi srl

Active Member
Licensed User
good morning everyone. I have a project that downloads a pdf file from an FTP server and that I should then open from the phone.
I did not understand how to apply Fileprovider and therefore to be able to open the file without necessarily having a specific pdf app (also because the classic pdf files that are present on the phone are opened normally). I would like to have some advice on how to manage this procedure. thank you
 

BlueVision

Active Member
Licensed User
Longtime User
Have a look here. Download the example from the last post. It is easy to understand.
Other solution:
If your SDK level is below 30, you have access to the download folder, where the file is downloaded normally when transferred via FTP. You can copy it from there and put it to the working directory of your app. Good idea is to delete it then from the download folder. Then you can do whatever you want with that file.

Edit:
You can delete the class module of the example and simply put a hook at the FILEPROVIDER library in the libraries list of B4A, it is now an internal library. Same with the starter service, when not needed. For that you have to define the defined variables in the starter in your main project and change the "starter" locations in the main program.
For starting the PDF, I would put it's name on a button, which turns to green if the pdf-file exists at the place you defined for. If the file is there, the button click opens a new activity and loads your PDF.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…