How do I find files of my running Delphi Rio app on Android Galaxy Tab S6 device

Using Delphi 10.3.2 Enterprise I ha,ve had little difficulty deploying a FMX app to Android 9 after success on a Windows tablet.

However, I'd like to know how to find the files of the running app, partly because I'd like to sideload some files (not using Google Play during development) and I cannot even see them.  I can interrogate GetHomePath and GetDocumentsPath and I see in Deployment manager their Remote Path values.  I'm assuming Delphi handles the slash/backslash issues and that's why the app runs at all.  I don't even see the "data" folder that is referenced in a lot of on-line guidance.

Using Window's File Explorer, the data folder is still inviisble.

Or am I missing the boat completely and things like FileExists don't actually work in Android?

In any case, I'd still like to be able to browse to the app's files.

Parents
  • All folders in Android which are not 'Shared' type folders can only be seen/accessed from the App itself.

    During installation you can only access certain folders to install files in. Ifyou want these files somewhere else, you then must then Move them to the required folder during App startup. That is a pain.

    I do stuff like this on startup, to get my sound files into a directory of which I have no access during installation:

    if not FileExists(TPath.Combine(TPath.GetRingtonesPath,'SARLog2.wav')) then
        begin
          try
            TFile.Copy(TPath.Combine(DirNames.PrivateDocDir,'SARLog2.wav'),
              TPath.Combine(TPath.GetRingtonesPath,'SARLog2.wav'),true);
          except
            on E:Exception do DoLog('Init: Copying SARLog2.wav: '+E.Message,d_error);
          end;
        end; 

    I have also written this handy procedure, which will show the files in a directory in 'Linux' format, so you can also see the attributes (which Android will *change* when you copy files into other directories)

    procedure ShowDirectory(APath: string);
    var
      AStringDynArray: TStringDynArray;
      i, AMax: integer;
    begin
      try
        AStringDynArray := TDirectory.GetFiles(APath);
        AMax := High(AStringDynArray);
        DoLog('ShowDirectory: '+APath+';   Count='+IntToStr(AMax));
        for i := 0 to AMax do
        begin
          DoLog(ShowAttributes(AStringDynArray[i])+' '+AStringDynArray[i]);
        end;
      except
        on E:Exception do DoLog('ShowDirectory: '+E.Message,d_error);
      end;
    end;

    Change the 'DoLog' to whatever log system you use.

Reply Children