Jump to content
Delpher2600

TDirectory.CreateDirectory not creating new folder

Recommended Posts

Hello. I'm using this code: 

TDirectory.CreateDirectory('/storage/emulated/0/NewFolder');

for creating new folder. And it's worked every time. But now i installed Delphi 11 CE and this code not working - new folder just not appering in the list of catalogs.

What is it and how fix it? 

Share this post


Link to post

The target API level for Delphi 11.3 defaults to 32, which is Android 12. Since Android 10, access to shared folders has been restricted.

 

You'll need to either  manually modify AndroidManifest.template.xml to change %targetSdkVersion% to 29 (Android 10) and ensure that the android:requestLegacyExternalStorage=true attribute is present on the application opening tag, or rethink how you're accessing files, e.g. whether they need to be in a shared area at all, and if so, whether to use MediaStore or DocumentsProvider.

 

You may want to read this.

 

Share this post


Link to post
29 minutes ago, Dave Nottage said:

You'll need to either  manually modify AndroidManifest.template.xml to change %targetSdkVersion% to 29 (Android 10) and ensure that the android:requestLegacyExternalStorage=true attribute is present on the application opening tag

O'K, how make it?

30 minutes ago, Dave Nottage said:

or rethink how you're accessing files, e.g. whether they need to be in a shared area at all, and if so, whether to use MediaStore or DocumentsProvider.

Well, i need getting access to shared folders for my app work. And how make it? Isn't it shared folder not must to be available to all? 

Share this post


Link to post
Posted (edited)

P.S. Now i checked - i can make a folders on the way: '/storage/emulated/0/Android/NewFolder', but i can't save a files there! 

Edited by Delpher2600

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×