Hi all! My Android app has an asset that could be necessary to be re-downloaded. On deploy process we put it there and later the user can/must download a new version.

Hi all! My Android app has an asset that could be necessary to be re-downloaded. On deploy process we put it there and later the user can/must download a new version.
Using TPath.GetDocumentsPath is where I get access to it (ie., if it is a database we use that to point it to be opened), but can I access the file at that location directly in intend to handle it? I need to rename it to old file, get the new one and activate as the new one.
The process don't raises any error but seems not be working.
Just want to know if it is possible, if yes I will dig to know what is going on here, if not possible I will try another approach.
Thanks!

Comments

  1. Yes, should be possible. I avoid deploying files but I regularly save files to that directory, check their dates, and save over them on Android and IOS.

    ReplyDelete
  2. Eli M Nice. What is your experience to avoid deploying the files there?

    ReplyDelete
  3. Depends on what it is. Download it when they first open the app? Store it in a TFDMemTable?

    ReplyDelete
  4. Eli M Not working. I am trying to store the file at the "root" (/storage/emulated/0/) and my app can create a folder there, but it is unable to create a file! I get i/o error 103.

    Using TPath.GetHomePath() will "Returns either the home path of the user or the application's writable scratch directory or storage" but I cannot write or create file or folder.

    Reading here and trying the example will fail.
    docwiki.embarcadero.com - System.IOUtils.TPath.GetHomePath - RAD Studio API Documentation

    Should I set any special permission?

    ReplyDelete
  5. It's a LG G5, not emulator. I was able to create a file in path /storage/emulated/0/ but I don't think it is safe. My app creates the folder in the root of the device. Gonna take a read at the article you sent. Thank you.

    ReplyDelete

Post a Comment