HBiSoft / PickiT

An Android library that returns real paths from Uri's

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android API 28: getPath of a Downloads URI not working

savvas17 opened this issue · comments

Describe the bug
getPath is unable to get the path of an image in the downloads folder for android 9 (API 28) specifically. Testing on API 27 works as expected. I assume that the path utility is missing certain cases for this type of provider.

Log
The file used to test is a simple .jpeg file of a medium size. Using a URI that originates from the File Manager (i.e. not the gallery).
Example URI: content://com.android.providers.downloads.documents/document/9
The response in the PickiTonCompleteListener:
image

Can it be reproduced in demo app
No this is for the following reason:

  • The demo app uses a picker intent to get the URI, this returns a content://com.android.providers.media.documents URI. Notice that this is a media URI and not a downloads URI. If a downloads/documents URI is obtained through other means (like for example sharing an image with an app), then this URI does not work. The demo app can't get URIs of the type stated above for Android 9.

PickiT version

  • 0.1.14

Device information

  • Pixel 2 (Emulator)
  • API 28

If a downloads/documents URI is obtained through other means (like for example sharing an image with an app)

Please provide an example of this (how you obtain the Uri).

I reproduced the URI in the Example app, and the example app managed to get the path correctly. This leads me to believe that it may be a problem with my code. For now I will close the issue. Thank you.