Riccardo Daria

Riccardo Daria

  • 1.7k
  • 74
  • 5k

Xamarin on ANDROID Save text file and get it from PC

Feb 1 2024 8:09 AM

i have an APP who save test file, thi is the code: 

string fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData  ), "Test.txt");                
//Pass the filepath and filename to the StreamWriter Constructor
StreamWriter sw = new StreamWriter(fileName);
//Write a line of text
sw.WriteLine("Hello World!!");
//Write a second line of text
sw.WriteLine("From the StreamWriter class");
//Close the file
sw.Close();

the file is saved on this path:

/data/user/0/com.companyname.inventario_app/files/.local/share/Test.txt

The problem IS:

Why I can't find the file on mobile device using computer, (the computer is connected by USB)?

There is a way for save the text file on a accessible folder of the DEVICE?

Or there is a way to get the file from PC??

THANKS a lot


Answers (2)