How do I read a local file on android?


#1

What is the simplest way to read a local text file (on an android device)?

I’ve tried:

  readAsString = async () => {
    let result = null;
    try {
      result = await Expo.FileSystem.readAsStringAsync(Expo.FileSystem.documentDirectory + 'screens/rn.txt');
    } catch (e) {
      console.log(e);
    }
    console.log(result)
    return result;
  }



    var readtest = Promise.resolve(this.readAsString())
    readtest.then(function (value) {
      console.log("hello file: " + value);
    });


/data/user/0/host.exp.exponent/files/ExperienceData/%40vidarso%2FSau/screens/rn.txt (No such file or directory)


closed #2

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.