I'm trying to use Meteor 1.4 with Cordova (mobile support) to read files on my android phone.
I've got a small Meteor app running on my phone (via meteor run android-device
). I have also created a small text file in the app's private storage using adb shell
and run-as
.
I can read the file if I call getFile('a')
, but I can't find any way to use cordova.file.dataDirectory
(even with WebAppLocalServer.localFileSystemUrl
) as recommended in the Meteor guide. I get FileError {code: 5}
(ENCODING_ERR).
Here's the JS console output from the Chrome inspector when I click the button in my app:
- This repros on both Android 5 and 6.
- My dev environment is 64-bit Ubuntu 14.04 LTS.
- App Info for my app reports it has these permissions:
- modify or delete the contents of your SD card
- read the contents of your SD card
- The app uses the cordova file plugin version 4.2.0.
- Dup? How to read/write a file in Meteor-Cordova?
- This does work in the
chrome://inspect
console via USB debugging:HTTP.call('GET', 'http://localhost:12640/local-filesystem/data/user/0/com.adammonsen.app/files/a', {}, function (e,r) {console.error(e); console.log(r)});
- output is
Object {statusCode: 200, content: "in external dir↵", headers: Object, data: null}
- output is