Giter VIP home page Giter VIP logo

Comments (9)

anggrayudi avatar anggrayudi commented on June 5, 2024

What's your OS version?
BTW, your stacktrace is pretty strange. You did edit before posting it here. Normal raw downloads URI will look like this:

content://com.android.providers.downloads.documents/tree/downloads/document/raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2FReceived%2FScreenshot_2021-05-12-12-13-57-317_com.android.chrome.jpg

from simplestorage.

sagarnayak avatar sagarnayak commented on June 5, 2024

I have android 10. ROM - Funtoch OS_10.

The stack is exactly as I am getting in my log. it's not changed. I was selecting a file from the Downloads folder in internal storage.

My best guess is that I am missing something in the permissions section. I already am asking for READ and WRITE external storage and also have done this https://github.com/anggrayudi/SimpleStorage#request-storage-access.

from simplestorage.

anggrayudi avatar anggrayudi commented on June 5, 2024

Can you log the following code for me?

storageHelper.onFileSelected = { requestCode, file ->
    val writableDownloads = if (file.isDownloadsDocument) file.toWritableDownloadsDocumentFile(context) else file
    Log.d(TAG, writableDownloads.uri)
    Log.d(TAG, writableDownloads.isWritable)
    Log.d(TAG, file.uri)
    Log.d(TAG, file.isWritable)
}

BTW, writableDownloads should work after calling file.toWritableDownloadsDocumentFile(context). Try it.

from simplestorage.

sagarnayak avatar sagarnayak commented on June 5, 2024

null
null
content://com.android.providers.downloads.documents/document/raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2FReceived%2FScreenshot_2021-05-12-12-13-57-317_com.android.chrome.jpg
true

from simplestorage.

anggrayudi avatar anggrayudi commented on June 5, 2024

Please try version 0.6.0-SNAPSHOT. toWritableDownloadsDocumentFile() no longer returns null.
Now you can get the actual file location via getAbsolutePath():

storageHelper.onFileSelected = { requestCode, file ->
    val fileLocation = file.getAbsolutePath(context)
}

from simplestorage.

sagarnayak avatar sagarnayak commented on June 5, 2024

I am getting uri but the path is blank.

image

from simplestorage.

anggrayudi avatar anggrayudi commented on June 5, 2024

Please refresh your dependencies. Follow this instruction: https://stackoverflow.com/a/62085606/3922207

Now it worked for me:

image

from simplestorage.

sagarnayak avatar sagarnayak commented on June 5, 2024

working now. thanks

from simplestorage.

anggrayudi avatar anggrayudi commented on June 5, 2024

Stable version 0.6.0 has been released.

from simplestorage.

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.