PRDownloader icon indicating copy to clipboard operation
PRDownloader copied to clipboard

PRDownloader Not Working on API 17!

Open lekeope opened this issue 6 years ago • 2 comments

I ran the code on API 17. it's not working @amitshekhariitbhu, @janishar , @aamir2590, @doersweb, @balsikandar

here's my code -> https://github.com/Edge-Developer/PRDownloader_Bug/blob/master/app/src/main/java/com/edgedevstudio/test/MainActivity.kt

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    PRDownloader.initialize(getApplicationContext())
    val url = "http://www.alexszepietowski.com/wp-content/uploads/downloads/2013/03/The 2 Golden Rules of Property, Business and Life!.pdf"
    val fileName = "MyFile.pdf"
    val dirPath = "/File Downloader/PDF/$fileName"
    val downloadId = PRDownloader.download(url, dirPath, fileName)
            .build()
            .setOnStartOrResumeListener {  Log("OnStartOrResumeListener. onStartOrResume")}
            .setOnPauseListener { }
            .setOnCancelListener{ Log("OnCancelListener. onCancel")}

            .setOnProgressListener {
                Log("Progress = ${((it.currentBytes / it.totalBytes) * 100)}%")
            }
            .start(object : OnDownloadListener {
                override fun onDownloadComplete() {
                    Log("OnDownloadListener. onDownloadComplete")
                }

                override fun onError(error: Error) {
                    Log("onError. isConnectionError = ${error.isConnectionError}, isServerError = ${error.isServerError}")

                }
            })
    Log("onCreate, DownloadId = $downloadId")
}
fun Log(msg : String){
    Log.d("MainActivity", msg)
}
}
```


Here's my log output



```
09-03 18:21:23.759 D/MainActivity: onCreate, DownloadId = 1621365470

09-03 18:21:26.389 D/MainActivity: OnStartOrResumeListener. onStartOrResume

09-03 18:21:26.389 D/MainActivity: onError. isConnectionError = true, isServerError = false
```

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
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
```

lekeope avatar Sep 04 '18 16:09 lekeope

I have a same problem on API 19 (Kitkat)

dembal1990 avatar Sep 13 '18 09:09 dembal1990

@dembal1990 move to Fetch -> https://github.com/tonyofrancis/Fetch

It seems the authors of this library have a lot on their plate, hence unavailable to solve issues like this

lekeope avatar Sep 15 '18 20:09 lekeope