Git Product home page Git Product logo

Comments (5)

droidwithme avatar droidwithme commented on August 16, 2024 1

from fuck-storage-access-framework.

K1rakishou avatar K1rakishou commented on August 16, 2024 1

Just FYI there is a test app that is also a sample app where you can find some info: https://github.com/K1rakishou/Fuck-Storage-Access-Framework/tree/develop/fsaf_test_app

What I want

  1. app launch
  2. ask permission for storage
  3. create a folder in root directory
  4. RxDownloader will emit a file (from temp storage) I want to save that

Basically you need to create FileChooser and then call fileChooser.openChooseDirectoryDialog(). This will request the user to select a directory where you will be able to store any kind of files until the user either uninstalls the app, revokes the permission or deletes the directory manually. Permissions will be requested automatically. Then in the onResult callback you do

val rootDir = fileManager.fromUri(uri)

You may probably want to also persist that uri somewhere (shared prefs) so you don't have to request it every time.
And then you can do whatever you want. Here is how you can create a file inside that directory:

val file = fileManager.create(rootDir, FileSegment("file1.txt"))
assert("file1.txt", fileManager.getName(file))

from fuck-storage-access-framework.

K1rakishou avatar K1rakishou commented on August 16, 2024

If I understand the questions correctly:

  1. You can use FileManager.fromPath()/FileManager.fromRawFile() and pass there any path or file. The SAF alternative is fileManager.fromUri().
  2. I think SAF grants the permission for the whole directory and all sub-directories/files.
  3. https://github.com/K1rakishou/Fuck-Storage-Access-Framework#creating-a-new-file-or-directory

from fuck-storage-access-framework.

droidwithme avatar droidwithme commented on August 16, 2024

from fuck-storage-access-framework.

K1rakishou avatar K1rakishou commented on August 16, 2024

I guess this issue is resolved.

from fuck-storage-access-framework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.