Android Question (Solved) Problem to open PDF document, android 5.0.1

jruiz1998

Member
Licensed User
Longtime User
I'm having problems with the FileProvider Class (android 5.0.1). I can not open pdf files with any pdf reader from the App. A message appears saying "Error to show PDF" using PDF viewer from Drive, and "This document can not be open" using Polaris Office 5, but outside of my app it works fine.
I tested with other version (android 8.0) and no problem, it works fine from the App.
I read that FileProvider Class, should work on all android versions (4+).

Can someone help me?

Thanks in advance
JRuiz
 

jruiz1998

Member
Licensed User
Longtime User
Ver 8.0
Using FileProvider? true

Log("dir: " & Starter.Provider.SharedFolder & ", file: " & FileToSend)
dir: /data/user/0/b4a.wallace/files/shared, file: #FacturaExp45.pdf
-------------------------------------------------------------------------------

Ver 5.0.1
Using FileProvider? false

Log("dir: " & Starter.Provider.SharedFolder & ", file: " & FileToSend)
dir: /storage/emulated/0/Android/data/b4a.wallace/files/shared, file: #FacturaExp45.pdf
------------------------------------------------------------------------------

FileProvider has diferent status. Why?
And SharedFolder are also diferent. Does it mind?


JRuiz
 
Upvote 0

jruiz1998

Member
Licensed User
Longtime User
SOLVED ..

Erel, I made a change in FileProvider Class
I modified
If p.SdkVersion >= 24 Or File.ExternalWritable = False
To
If p.SdkVersion >= 21 ...

And it works fine with android 5.0.1.

Also changed the Log
Log("dir: " & Starter.Provider.SharedFolder & ", file: " & FileToSend)

From
dir: /storage/emulated/0/Android/data/b4a.wallace/files/shared, file: #FacturaExp45.pdf
To
dir: /data/user/0/b4a.wallace/files/shared, file: #FacturaExp45.pdf

Thanks a lot
JRuiz
 
Upvote 0
Top