-1

For months the code provided in this answer was ok for me (Android - Copy assets to internal storage) to copy pdf files.....until yesterday a client report me that on his "Lg g2, with Android 4.4.2" this does'nt work....the app does'nt crash but the alert tell him "the document path is not valid"....

maybe because the mobile hasn't an external storage?

i'm not sure if the file copied well and the problem is opening the pdf file....but in others phone works ok...

EDIT 1: Ok, I still dont knonw the reason of that on his LG G2 but, i solved this by checking if the external storage is available and writable, and if not, i copied the files into /data/data/package.name/ and then i used a content provider to read/access it....

I edited just in case this is helpfull for others

EDIT 2 (may 5th): well, the same client with the LG G2 told me that he actually has a sdcard...Reading this post (Howto avoid the "EACCES permission denied" ON SDCARD with KITKAT 4.4.2 Version. New policy from google) i believe is all because 4.4.2...so frustating...

So, my final solution was, check if the external storage is available, writable and if android API version < 19, and if not, i copied the files into /data/data/package.name/ and then i used a content provider to read/access it....like before ;)

Thx again

Community
  • 1
  • 1
lienmt
  • 147
  • 8

1 Answers1

1

Possibly because 4.4 doesn't allow you to arbitrarily write to the SD card.

majinnaibu
  • 2,832
  • 1
  • 18
  • 22
  • Possibly or is that a fact? – lienmt May 06 '14 at 07:19
  • Both. It's a fact they made the change, by depending on the folder being written to it might not be the problem here. Are the other devices its working on also 4.4? What folder are you writing to? What is the error message you're getting? Did it work on this device on 4.4 before? I only know of one app that manages to get around this "File Expert HD". I doubt that will continue to work for long. – majinnaibu May 06 '14 at 16:14
  • Yes, the same app/code is running in other devices with 4.4. I'm copying the pdf file from assets to external storage (if there is). The alert showed to the user was this one "the document path is not valid" but any crash was reported...and i dont know if it work in the same devices before 4.4 because it is a new client feedback. Thx for your reply... – lienmt May 06 '14 at 16:57