Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Feature Request: Download Files #426

Closed
jrahma opened this issue Jul 28, 2018 · 10 comments
Closed

Feature Request: Download Files #426

jrahma opened this issue Jul 28, 2018 · 10 comments
Labels
needs-more-discussion This needs more discussion or info before discussing it as a proposal. needs-specifications Accepted feature/enhancement and needs specification.

Comments

@jrahma
Copy link

jrahma commented Jul 28, 2018

Hi,

Please add a feature to download files in Xamarin Forms platform, for example, photoz, documents, etc..

Thanks,
Jassim

@gsmental
Copy link

File download with downloaded percentage so that developer can easily display in progress bar.

@mattleibow
Copy link
Contributor

This can already be done with WebClient which is available in .NET Standard 2.0: https://docs.microsoft.com/en-us/dotnet/api/system.net.webclient?view=netstandard-2.0

And then if you really want to go hardcore, you can have a look at the source for this baby: https://github.com/dotnet/corefx/blob/master/src/System.Net.WebClient/src/System/Net/WebClient.cs

@Redth Redth added the need-more-information Need more information to investigate a bug or proposal label Nov 26, 2018
@Redth
Copy link
Member

Redth commented Nov 26, 2018

Yeah I'm not sure what value we can add to HttpClient or WebClient.

If you think there's something missing, please elaborate.

@Redth
Copy link
Member

Redth commented Nov 28, 2018

One thing that has come to my attention is that we might want to enable background downloading of files such as with NSUrlSession on iOS, and perhaps just generic background tasks on Android/UWP.

This might be interesting. Need to research more details on how NSUrlSession works and how that influences what the xplat API will look like.

@Redth Redth added needs-specifications Accepted feature/enhancement and needs specification. needs-more-discussion This needs more discussion or info before discussing it as a proposal. and removed need-more-information Need more information to investigate a bug or proposal labels Nov 28, 2018
@gsmental
Copy link

property and methods
FileUrl --string or URI
IsUrlExistsOnServer --bool
ClientAppFilePath --string
DeleteIfAlreadyExists --bool

and event which will fire during downloading of file and provide information as below
TotalSizeInBytes --double
DownloadedSizeInBytes --double
Percentage -- decimal (it is option otherwise we have to calculate manually)

@Redth
Copy link
Member

Redth commented Nov 29, 2018

As we've discussed in another issue around background tasks, we can't really work with events for this situation, since we aren't really guaranteed to have that context kept around for us. Android for instance simply sends a broadcast when the file is done downloading, and we must handle that with a broadcast receiver which may be called after our application has been terminated and restarted (even something as simple as a reboot).

I think this one is going to depend on us working out the pattern for #409 first

@DanielCauser
Copy link

@jrahma I'm using this lib for exactly what you want.
https://github.com/aritchie/httptransfertasks

@Redth
Copy link
Member

Redth commented Dec 3, 2018

I think we can come up with an event that can be subscribed to while the app is in the foreground, but of course it is possible the event will stop firing once the app enters the background.

@newky2k
Copy link
Contributor

newky2k commented May 12, 2020

As there is a library that provides this functionality already we are going to close this off.

@newky2k newky2k closed this as completed May 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-more-discussion This needs more discussion or info before discussing it as a proposal. needs-specifications Accepted feature/enhancement and needs specification.
Projects
None yet
Development

No branches or pull requests

6 participants