如何在xamarin.forms中下载文件?
大家好!我陷入了一个问题。 我们认为,由于某些原因,我们需要为游戏制作自己的启动器,该游戏将检查其版本并下载。我们的团队中没有Xamarin开发人员,所以我被要求自己尝试。卡在下载第二天。 我安装了Nuget插件下载Manager,试图使用它并且没有成功。一些印度人的视频也没有帮助我。 我可以做游戏,但完全吸引了移动开发。我应该怎么办?
我尝试过:
- 使用EventHandler制作IDownloader(URL,文件夹),这无助于
- 使用这些代码使用插件。将其链接到按钮。这也没有帮助我。您的帮助将挽救我的生命
void DownloadFile()
{
var downloadManager = CrossDownloadManager.Current;
var file = downloadManager.CreateDownloadFile("someURIGodSaveMe");
downloadManager.Start(file);
}
Good day everyone! I am stuck on a problem.
We decided that for some reasons we need to make our own launcher for a game which will check its version and download .apk of the game to install. We dont have a xamarin developer in our team, so I was asked to try do it myself. Stuck on downloading for the 2nd day.
I installed NuGet plugin DownloadManager, tried to use it and did not succeed. Some indian guy video's didn't help me either.
I can make a game, but totally suck in mobile development. What should I do?
I tried:
- Making IDownloader(url, folder) with EventHandler, that did not help
- Using plugin with these code. Linked it to a button. This did not help me too. Your help will save my life
void DownloadFile()
{
var downloadManager = CrossDownloadManager.Current;
var file = downloadManager.CreateDownloadFile("someURIGodSaveMe");
downloadManager.Start(file);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要任何特别的东西就可以在xamarin.forms中下载文件,良好的旧
httpclient
可以完成工作。此代码将文件从URL下载到应用程序内部存储。有关
emoverition.specialfolder.personal
in xamarin.forms 在这里,有关emoveruct.pecialfolder.personal
的更多信息。我还发现这个非常不错-en.html“ rel =“ nofollow noreferrer”>用于下载大文件的教程xamarin.forms 如果您想花哨(虽然没有尝试过)。它支持下载进度栏和取消。
You don't need anything special to download files in Xamarin.Forms, the good old
HttpClient
does the job.This code downloads a file from a URL to the apps internal storage. More about
Environment.SpecialFolder.Personal
in Xamarin.Forms here.I also found this very nice tutorial for downloading large files in Xamarin.Forms if you want to get fancy (haven't tried it though). It supports download progress bar and cancellation.