Copy link to clipboard
Copied
Hello! I'm developing an AIR android app. I want to be able to write/read files in File.documentsDirectory, which is the Internal Storage folder in Android (I think, or Device Storage). I don't want the SD card, and not the App storage folder, but the folder which you can access through My files or via a PC when you connect the phone with a USB cable.
So, File.documentsDirectory will get me there, but only if I go into the Application settings, click on my app, go to permissions, and click "Storage". Then it will work, otherwise not. I've already given the app permission to
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
That doesnt work, I need to go in manually in the permissions settings and add the Storage folder.
I want this to be automatic, do I need to put a URI or something in the Application.xml?
I'm stuck, please help me!
Thanks in advance
Cheers
Copy link to clipboard
Copied
Ok, solved it, this will give my app permission:
var file:File = File.documentsDirectory.resolvePath(saveFolder);
file.addEventListener(PermissionEvent.PERMISSION_STATUS, onPermission);
file.requestPermission();
But I got another problem... the PermissionEvent is not dispatched... Now I need to solve that
Copy link to clipboard
Copied
Solved second problem with a Activation event rather than a PermissionEvent... When the Permission window is closed the ActivationEvent will trigger. But it would be nice to have the PermissionEvent work because I have to add some extra code inside the ActivationEvent to make sure it's the right ActivationEvent. Because it will also trigger if I go in and out of the app for example.
Just wrighting this in case anyone else has the same problem.