1

The following code works with Delphi 10.2.2 Tokyo, but not with Delphi 10.3 Rio.

I tried the code on two devices (actually it's an old code which already worked).

strCoverPath := System.IOUtils.TPath.GetSharedMusicPath;
strCoverPath := Copy(strCoverPath, 0, strCoverPath.Length - 5) + 'Mp3PlayerNG/';

if ForceDirectories(strCoverPath + 'images') then
  blnDirExists := true;

The value of strCoverPath is: '/storage/emulated/0/Mp3PlayerNG/'. Running the code on Delphi 10.2.2 Tokyo, everything works well. The directories are created and the application works fine.

Running the code on Delphi 10.3, the directories are NOT created. There is NO errormessage or anything I can see. Without the directories the application won't work, because several files have to be stored in the directories.

Does anyone know how to solve this problem? I couldn't find anything searching the internet. Thanks in advance!

Dalija Prasnikar
  • 27,212
  • 44
  • 82
  • 159
  • 1
    Delphi Rio adds support for API 26 where you need to ask for runtime permissions to access common folders. You can find solution and more explanation at linked question – Dalija Prasnikar Jan 16 '19 at 20:07
  • 1
    It's not related to the "external storage". I want to write to the "internal SD card" (/storage/emulated/0/). There's no permission to set in the project options. As I said, it works fine on Delphi 10.2.2, but not on Delphi 10.3 Rio. So it is not related to the Android API. – XingFu ZhuanYun Jan 17 '19 at 08:40
  • 3
    GetSharedMusicPath is shared folder that also requires runtime permission. It is related to Android API because your application no longer works in compatibility mode, you need to implement runtime permissions to access that folder. While there are some differences in what you are doing the solution is the same as in linked question. – Dalija Prasnikar Jan 17 '19 at 09:08
  • @Dalija Prasnikar Thanks for leading me to the right way! – XingFu ZhuanYun Jan 17 '19 at 17:53

0 Answers0