Downloads a file using the Android's built-in download manager which creates a notification with the current download status and a custom title and description.
In some cases there seems to appear a dialog - you can prevent that using the NoDialog option.
With this methof you won't be able to get a OnComplete callback - if you need that check out CreateDownloader.
Example - Downloading the DroidScript logo
function OnStart()
{
var src = "http://www.androidscript.org/droidscriptwp/wp-content/uploads/2015/10/droidscript_logo_64x64.png";
var dst = "/sdcard/Downloads/logo.png";
app.DownloadFile(src, dst, "MyTitle", "My Description", "NoDialog");
}
def OnStart():
src = "http:# www.androidscript.org/droidscriptwp/wp-content/uploads/2015/10/droidscript_logo_64x64.png"
dst = "/sdcard/Downloads/logo.png"
app.DownloadFile(src, dst, "MyTitle", "My Description", "NoDialog")
Example - Download to external storage
function OnStart()
{
var src = "http://www.androidscript.org/droidscriptwp/wp-content/uploads/2015/10/droidscript_logo_64x64.png";
var dst = app.GetExternalFolder() + "/Downloads/logo.png";
app.DownloadFile(src, dst, "MyTitle", "My Description", "NoDialog");
}
def OnStart():
src = "http:# www.androidscript.org/droidscriptwp/wp-content/uploads/2015/10/droidscript_logo_64x64.png"
dst = app.GetExternalFolder() + "/Downloads/logo.png"
app.DownloadFile(src, dst, "MyTitle", "My Description", "NoDialog")