novoda / download-manager

A library that handles long-running downloads, handling the network interactions and retrying downloads automatically after failures
Apache License 2.0
483 stars 63 forks source link

Download not working with Redirect #471

Closed wman1980 closed 5 years ago

wman1980 commented 5 years ago

Hi,

I encountered a problem downloading a file from a url which redirects to another url (e.g. redirected url points to a video file hosted by a video on demand platform like 3qsdn.com). Both https urls. If I try to download the file with the redirected url directly it works.

Any ideas?

Regards

wman1980 commented 5 years ago

Actually this only occurs on Samsung Devices, e.g. S6 with Android 7.0.

I fixed it by adding:

[try { ProviderInstaller.installIfNeeded(context); } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) { e.printStackTrace(); }]

before I create my RequestQueue with Volley.

I don't understand why this fixes the issue?

Regards wman

Mecharyry commented 5 years ago

As per the docs on ProviderInstaller.

Installs the dynamically updatable security provider, if it's not already installed.

From what I understand when you perform a network call there are some security providers that are given. When you added the above, it bundled the Google play variety on top of this list, so that when a network call is now made it uses this new provider. As it is the Google play variety it is generally more up to date than the ones that are bundled on the device.

I just want to say that I am guessing that this is how it was fixed, I do not know for sure.

Mecharyry commented 5 years ago

I'll close this issue because you managed to resolve yourself. Let us know if you need any help with anything else.