Hey we’ve built an app for the GearVR, but due to size limitations we need to have the app download the video files first, and these files are quite large so we’d like to give the user the ability to close the app and let DownloadManager download the files in the background rather than keeping the app open. But we’ve been struggling with getting any Download Manager code to work, but strangely we have been successful with Toast messages which are invoked using the same AndroidJavaObject code.

Can anyone give us a hint as to what we’re doing wrong here?

currentActivity.Call ("runOnUiThread", new AndroidJavaRunnable (() => {
            try {
                AndroidJavaClass uriClass = new AndroidJavaClass ("");
                AndroidJavaObject uriObject = uriClass.CallStatic<AndroidJavaObject> ("parse", "");
                AndroidJavaObject request = new AndroidJavaObject ("$Request", uriObject);
                AndroidJavaObject downloadManager = new AndroidJavaClass ("");
                downloadManager = currentActivity.Call<AndroidJavaObject> ("getSystemService", "DOWNLOAD_SERVICE");

                long downloadID = downloadManager.CallStatic<long> ("enqueue", request);

                _text.GetComponent<UnityEngine.UI.Text>().text = downloadID.ToString();

            } catch (System.Exception e) {
                _text.GetComponent<UnityEngine.UI.Text>().text = e.ToString();

            AndroidJavaObject toast = new AndroidJavaObject("android.widget.Toast",currentActivity);


Hi There,

made this work by changing:


CallStatic (“enqueue”, request);
Call(“enqueue”, request);

Have you made any progress on this script? i would really like a robust script that allow you to set the filename, path and get some feedback on the download progress.