• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

AIR Android app, access internal storage

Community Beginner ,
Mar 10, 2018 Mar 10, 2018

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

TOPICS
Development

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 10, 2018 Mar 10, 2018

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 11, 2018 Mar 11, 2018

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines