Code Monkey home page Code Monkey logo

backgrounddownload's People

Contributors

aurimasc avatar danoli3 avatar jcunity avatar keiramoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

backgrounddownload's Issues

Can't access iOS file

Hi,

Can you provide more details on how to access the final downloaded file on iOS please?

I'm able to complete the download but it seems the file isn't actually being copied from the temp directory to the final directory.

I added a boolean value to determine if the replaceItemAtURL operation completes and it returns false.

[code=CSharp] NSFileManager* fileManager;
NSURL* destUri = GetDestinationUri(downloadTask.taskDescription, &fileManager);
[fileManager replaceItemAtURL: destUri withItemAtURL: location backupItemName: nil options: NSFileManagerItemReplacementUsingNewMetadataOnly resultingItemURL: nil error: nil];
UnityBackgroundDownload* download = [backgroundDownloads objectForKey: downloadTask];
download.status = kStatusDone;[/code]

Hoping someone who's familiar with iOS might have an idea about what is wrong?

I'm using Unity 2019.1.14f.

Thanks,

Android Java Exception

05-20 15:30:22.007 6687 6767 E Unity : AndroidJavaException: java.lang.ClassNotFoundException: com.unity3d.backgrounddownload.BackgroundDownload
05-20 15:30:22.007 6687 6767 E Unity : java.lang.ClassNotFoundException: com.unity3d.backgrounddownload.BackgroundDownload
05-20 15:30:22.007 6687 6767 E Unity : at java.lang.Class.classForName(Native Method)
05-20 15:30:22.007 6687 6767 E Unity : at java.lang.Class.forName(Class.java:453)
05-20 15:30:22.007 6687 6767 E Unity : at java.lang.Class.forName(Class.java:378)
05-20 15:30:22.007 6687 6767 E Unity : at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
05-20 15:30:22.007 6687 6767 E Unity : at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
05-20 15:30:22.007 6687 6767 E Unity : at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source:157)
05-20 15:30:22.007 6687 6767 E Unity : at android.os.Handler.dispatchMessage(Handler.java:105)
05-20 15:30:22.007 6687 6767 E Unity : at android.os.Looper.loop(Looper.java:207)
05-20 15:30:22.007 6687 6767 E Unity : at com.unity3d.player.UnityPlayer$c.run(Unknown Source:20)
05-20 15:30:22.007 6687 6767 E Unity : Caused by: java.lang.ClassNotFoundException: Didn't find class "com.unity3d.backgrounddownload.BackgroundDownload" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.dreamvr.app-teTJPn0kld-PS3kU1p1LSw==/base.apk"],nativeLibraryDirectories=[/data/app/com.dreamvr.app-teTJPn0kld-PS3kU1p1LSw

download.status == BackgroundDownloadStatus.Failed

I have 2019.3.9f1, integrated BackgroundDownloader in April'20, tested and everything was smooth on my android test-devices. Now I builded a new version, and the Manifest is not merging anymore.

Those informations may help:

  • I use the "2019.3 and older"-branch".
  • since April I integrated a custom proguard file (gradle) and needed to update the "Target API Level" of my App to "API Level 30". Hope this might help too.

Get the progress in iOS

Please take a look at the code below:

 using (var download = Unity.Networking.BackgroundDownload.Start(new Uri(URL), Application.persistentDataPath+"/temp/assets"))
        {
            while (download.progress <=1.0f) 
            {
                percent = download.progress * 100; 
                DownloadProgressbar.GetComponent<Progressbar>().SetValue((int)percent);
                yield return null;
            }

            yield return new WaitForSeconds(0.5f);
            

            if (download.status == Unity.Networking.BackgroundDownloadStatus.Failed)
            {
                Debug.Log(download.error);
            }
}

it does not give me the progress of my download operation. also I have used
yield return new download
but it doesn't work.

Please help with a proper documentation.
@aurimasc
@Tak
@lucasmeijer
Thanks in advance.

Large number of downloads problems

when we create large number of download(e.g:20000+files),this tool will be severe lagging,is there any solution to solve this condition~,thanks

Add configs by single method

@aurimasc

Can I use this custom methods? (in BackgroundDownload.cs)

Start(IEnumerable configs)
AvailiableDownloadConfig(BackgroundDownloadConfig config)

public static BackgroundDownload Start(BackgroundDownloadConfig config)
{
    LoadDownloads();

    if (AvailiableDownloadConfig(config) == false)
        return null;

    ...
}

public static void Start(IEnumerable<BackgroundDownloadConfig> configs)
{
    LoadDownloads();

    foreach (var config in configs)
    {
        if (AvailiableDownloadConfig(config) == false)
            continue;

        var download = new BackgroundDownloadimpl(config);
        _downloads.Add(config.filePath, download);
    }

    SaveDownloads();
}

private static bool AvailiableDownloadConfig(BackgroundDownloadConfig config)
{
    if (_downloads.ContainsKey(config.filePath))
    {
        string error = "Download of this file is already present";
        Debug.LogError(error);
        return false;
    }

    return true;
}

Gradle issue while building for Android with 2021.2.x version

Internal build system error. BuildProgram exited with code 87.
System.ArgumentException: Another action is already registered for /ProjectName/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/backgrounddownload.androidlib/build.gradle
New:{
"Annotation": "ActionGenerateProjectFiles /ProjectName/Library/Bee/Android/Prj/IL2CPP/Gradle/build.gradle (+6 others)",

Invalid value for visibility 2 in Android.

Hi, I am getting Invalid value for visibility 2 in Android. Currently, I am downloading video from server using.
using (var download = BackgroundDownload.Start(new Uri("https://site.com/example.mov"), "MyVideo.mov"))
WhatsApp Image 2020-03-28 at 1 16 08 PM

Concurrent Downloads?

I need a way to concurrently download multiple files - one at a time execution is not feasible. I've been using this repo as a replacement to yours until you support this feature. Am also looking for a way to pause and restart downloads?

Addressables fail to build in Editor when platform is set to Windows/standalone ('failed to produce updates.txt file')

EDIT: I mistook 'does not work in Editor, only compiles' to mean that it would still 'compile'/build - given how addressables are built I see now that is not the case

I am trying to get this package to work with addressables by rolling my own ResourceProvider. I have installed it via git url in the package manager.

I am able to successfully build addressables - in Editor - when the platform is set to iOS, but when set to Windows/Standalone, I get the following editor errors:

Script updater for Library\Bee\artifacts\1900b0aP.dag\Assembly-CSharp.dll failed to produce updates.txt file

Assets\_App\Scripts\BackEnd\Managers\BackgroundDownloadManager.cs(2,13): error CS0234: The type or namespace name 'Networking' does not exist in the namespace 'Unity' (are you missing an assembly reference?)

Failed to compile player scripts
UnityEditor.GenericMenu:CatchMenu (object,string[],int)

SBP ErrorError
UnityEditor.GenericMenu:CatchMenu (object,string[],int)

Addressable content build failure (duration : 0:00:06.422)
UnityEditor.GenericMenu:CatchMenu (object,string[],int)

I see that the main issues causing Library\Bee\artifacts errors to come up include:

  • having spaces in the filepath (I do not have spaces)
  • needing to delete the library folder (have done several times)
  • deleting and recreating .csproj files (have done several times).
  • using an unsupported Unity version (I am using 2021.3.16f1, which AFAIK this package supports)

The script I am using this in to test incredibly bare-bones, the error does not occur when I comment out any reference to Unity.Networking and BackgroundDownload:

using Unity.Networking;
using UnityEngine;

public class BackgroundDownloadManager : MonoBehaviour
{
    void Start()
    {
        var existingDownloads = BackgroundDownload.backgroundDownloads;
    }
}

Any help would be much appreciated, thanks.

iOS continue download

Hi,

Everything works fine on iOS, but when I close the app and then reopen it again the existing download is failed.
Any workaround for this?

Thanks,
Ivan

Throw exception

log.txt

This code not working
What is wrong?

List<BackgroundDownloadConfig> configList = GetConfigList();
foreach (var config in configList)
{
    BackgroundDownload.Start(config);
}

Multiple downloads

Can I queue multiple downloads?

foreach (var config in configList)  
{  
    BackgroundDownload.Start(config);
} 

Need support for Background Download project.

Hi jcunity,
We tried your backgrounddownload project but does not run properly.
we tried the sinlgefiledownload.cs script but does not download the file in android.
Give any suggestion to run it properly.
Thanks in Advance.

download.progress not returning correct value on Android 9.0

download.progress does not show a value between 0-1 on devices running Android 9.0 or above. download.progress jumps to 1 instantly, even though the download does actually continue in the background as expected, and will ultimately download successfully. This will cause progress bars based off of the download percentage to fail.

Android - Downloaded File is deleted when DownloadStatus becomes Done

I've tested this on different devices, and it only happens when i seem to use a device running Android 7.0. When the download changes status to Done, then the file is deleted. Before that, i can see that the file is present in the correct destination folder, but as soon as it finishes downloading, the file is gone.

Feature Request: Equivalent package for uploads

Our app creates high-bandwidth user-generated content we need to upload to our (S3) servers. So I'd love to see a package that also supports uploads. Are you aware of any or see a chance to extend this package for uploads? I looked in the Asset Store, but couldn't find any.

Gradle isue in 2020.3.16f1

I can't build the project, it says there is a problem with the Gradle.
If I remove the asset, I can build

Manifest isn't picked up in 2019.3

In Unity 2019.3, because of the manifest changes, when building for Android none of the items in the AndroidManifest are included in the final manifest of the app.

This causes the permissions not to be set correctly and the absence of the completion receiver.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.