Closed lekeope closed 6 years ago
val dirPath = "/FileDownloader/PDF/$fileName"
looks incorrect.
Try something like context.getCacheDir()
and append your dir path.
please type out a sample code
D/LibGlobalFetchLib: DownloadManager starting download DownloadInfo(id=-94132710, namespace='LibGlobalFetchLib', url='http://www.alexszepietowski.com/wp-content/uploads/downloads/2013/03/The%202%20Golden%20Rules%20of%20Property,%20Business%20and%20Life!.pdf', file='/data/user/0/com.edgedevstudio.fetchdownloadmanagerissue/cache/FileDownloader/PDF/MyFile.pdf', group=0, priority=HIGH, headers={clientKey=SD78DF93_3947&MVNGHE1WONG}, downloaded=0, total=-1, status=QUEUED, error=NONE, networkType=ALL, created=1536090340704, tag=null, enqueueAction=REPLACE_EXISTING, identifier=0, downloadOnEnqueue=true, extras={})
D/LibGlobalFetchLib: FileDownloader starting Download DownloadInfo(id=-94132710, namespace='LibGlobalFetchLib', url='http://www.alexszepietowski.com/wp-content/uploads/downloads/2013/03/The%202%20Golden%20Rules%20of%20Property,%20Business%20and%20Life!.pdf', file='/data/user/0/com.edgedevstudio.fetchdownloadmanagerissue/cache/FileDownloader/PDF/MyFile.pdf', group=0, priority=HIGH, headers={clientKey=SD78DF93_3947&MVNGHE1WONG}, downloaded=0, total=-1, status=QUEUED, error=NONE, networkType=ALL, created=1536090340704, tag=null, enqueueAction=REPLACE_EXISTING, identifier=0, downloadOnEnqueue=true, extras={})
D/MainActivity: FetchListener. onStarted
D/MainActivity: FetchListener. onDownloadBlockUpdated
D/MainActivity: FetchListener. onDownloadBlockUpdated FetchListener. onProgress
D/MainActivity: FetchListener. onCompleted
i mean, actual code NOT log output
The commit is the code, I will paste here for you.
val dirPath = "$cacheDir/FileDownloader/PDF/$fileName"
thanks man, i'm about to try it out
hey, it did indicate that file was successfully downloaded but i am unable to find the actual downloaded file.
I've use file explorer and found nothing
Good fetch is working.
Cache directory is a sandboxed directory in your application folder. I used this example because sandboxed directories do not require PERMISSIONS
to write to it. Just so you know cache directory can be found at /Android/data/
.
I rewrote your sample app to request permissions and write to the root DOWNLOAD
folder like you are expecting.
Thanks very much! So helpful
It worked!
I tried out the library and it's not working.
Here's my code
AndroidManifest.xml
Log output
D: FetchListener. onError. Error = UNKNOWN_IO_ERROR, Download = DownloadInfo(id=-1721883501, namespace='LibGlobalFetchLib', url='http://www.alexszepietowski.com/wp-content/uploads/downloads/2013/03/The%202%20Golden%20Rules%20of%20Property,%20Business%20and%20Life!.pdf', file='/FileDownloader/PDF/MyFile.pdf', group=0, priority=HIGH, headers={clientKey=SD78DF93_3947&MVNGHE1WONG}, downloaded=0, total=-1, status=FAILED, error=UNKNOWN_IO_ERROR, networkType=ALL, created=1536016053913, tag=null, enqueueAction=REPLACE_EXISTING, identifier=0, downloadOnEnqueue=true, extras={})
you can check out my full code here -> https://github.com/Edge-Developer/FetchDownloadManagerIssue