Question

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

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top