question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I tried out the library and it’s not working.

Here’s my code

class MainActivity : AppCompatActivity() {
// fetchListener code, removed, for the sake of brevity.

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val url = "http://www.alexszepietowski.com/wp-content/uploads/downloads/2013/03/The%202%20Golden%20Rules%20of%20Property,%20Business%20and%20Life!.pdf"
        val fileName = "MyFile.pdf"
        val dirPath = "/FileDownloader/PDF/$fileName"

        val fetchConfiguration = FetchConfiguration.Builder(this)
                .setDownloadConcurrentLimit(3)
                .build()

        val fetch = Fetch.getInstance(fetchConfiguration)

        val request = Request(url, dirPath)
        request.priority = Priority.HIGH
        request.networkType =  NetworkType.ALL
        request.addHeader("clientKey", "SD78DF93_3947&MVNGHE1WONG")

        fetch.addListener(fetchListener)

        fetch.enqueue(request)
    }

    fun Log(msg: String) {
        android.util.Log.d("MainActivity", msg)
    }
}

AndroidManifest.xml

<manifest
  ... >

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <application
        ...>
        ...
    </application>

</manifest>

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
beforacommented, Sep 4, 2018

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.

https://github.com/sethchhim/FetchDownloadManagerIssue/commit/c083874844ca9f6949f749b2b004eac7f8f7aedf

1reaction
beforacommented, Sep 4, 2018

The commit is the code, I will paste here for you.

val dirPath = "$cacheDir/FileDownloader/PDF/$fileName"

Read more comments on GitHub >

github_iconTop Results From Across the Web

138 Synonyms & Antonyms for NOT WORKING - Thesaurus.com
synonyms for not working · baseless · false · inoperative · irrational · null · unreasonable · unscientific · unsound ...
Read more >
Working Not Working
Trusted by over 2000 of the world's most innovative companies to staff their creative projects.
Read more >
Not Working: Cohen, Josh - Amazon.com
'Not Working' is an excellent companion to existentialism or those reading that subject or the subject of work, its philosophy and stress caused...
Read more >
Not Working: Where Have All the Good Jobs Gone?
Not Working is about those who can't find full-time work at a decent wage—the underemployed—and how their plight is contributing to widespread ...
Read more >
Fix an installed Android app that isn't working - Google Support
Try the following steps if an app installed on your phone has any of these problems: Crashing. Won't open. Won't respond. Isn't working...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found