TXT file on android

1

How do I write a TXT file on android using delphi 10 Seatle? I have tried this way and only the error;

  try
    file1 := TIniFile.Create(System.IOUtils.TPath.GetDownloadsPath+PathDelim+'postogestorcoletor.ini');
    file1.WriteString('postogestorcoletor','testeteste', 'asasasasasas');
    file1.Free;
  finally
    ShowMessage('Erro ao criar arquivo');
  end;
    
asked by anonymous 27.10.2017 / 17:19

1 answer

0

I do not know why you create the file on Android, I usually create the file in .ini folder and when I do the Deploy I send the file together.

I hope I have helped.

uses
   System.IOUtils   

{$IF DEFINED (ANDROID)}
file1 := TIniFile.Create(TPath.Combine(TPath.GetDocumentsPath,'postogestorcoletor.ini');
try
  file1.WriteString('postogestorcoletor','testeteste', 'asasasasasas');
finally
  FreeAndNil(file1);
end;
{$ENDIF}
    
27.10.2017 / 17:55