Code example for DownloadManager

Methods: enqueue

0
    } 
 
    public void testDownloadManagerRequest() { 
        // first try a minimal request 
        DownloadManager.Request request = new DownloadManager.Request(Uri.parse("http://localhost/path"));
        mManager.enqueue(request);
 
        // now set everything we can, save for external destintion (for which we lack permission) 
        request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
        request.setAllowedOverRoaming(false);
        request.setTitle("test");
        request.setDescription("test");
        request.setMimeType("text/html");
        request.addRequestHeader("X-Some-Header", "value");
        mManager.enqueue(request);
    } 
} 
Experience pair programming with AI  Get Codota for Java