[NativeMobile] Cannot find or open a file downloaded via Native file documents module

1
Hello experts,   I’m using the sample project https://marketplace.mendix.com/link/component/114253 for testing some ideas, and unfortunately I’m failing to open the downloaded file on my device. Please see the picture To investigate the issue, I’ve created some extra JScript, with no success I’ve checked the properties in the DownloadFileProgress object and there’s no errors   I simply cannot find the file ‘/data/user/0/myapp.nativefiledocumentsdemo.developerapp/files/Seguros.xlsx’ on my device, and I use the JS ‘viewFile’ to open the file with the associated application (in this case, ExcelMobile), it opens but doesn’t show the file. What am I doing wrong?   Thanks in advance!   
asked
1 answers
0

Hello All

 

For those of you with the same problem, I’ve manage to find a feasible solution.

Indeed, the file is downloaded to the device, as I mentioned. But I could not find the file.

The key to solution is use the “Device File Explorer” from Android Studio. 

Using the activity “get temporary directory” the file is downloaded to the “cache” subfolder in the application directory tree. Unfortunatelly, we cannot open this file using the full path in the “view file” activity.

The alternative is to create another activity to use other options from the RNFS package. In this case, DocumentDirectoryPath. This will able us to save in the “files” subfolder. The same issue happens when we try to use the full path in the “view file” activity. But when we use only the file name (withou the path) it works!! See the pictures bellow.

 

 

In summary, use the custom activity “getDocumentsDirectory” to generate the full path of your file, and then use the ‘view file’ defining only the filename (without the path) to view the file.

answered