Android Download Manager

前端 未结 4 1215
慢半拍i
慢半拍i 2021-02-06 13:29

I think i have a rather simple question.

http://www.vogella.com/blog/2011/06/14/android-downloadmanager-example/

I have been following a tutorial in the above ur

4条回答
  •  无人共我
    2021-02-06 13:45

    You configure the DownloadManager.Request object with that sort of information. In the tutorial, that Request object is created and used in onClick().

    For example:

    DownloadManager.Request req=new DownloadManager.Request(uri);
    
    req.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI
                                   | DownloadManager.Request.NETWORK_MOBILE)
       .setAllowedOverRoaming(false)
       .setTitle("Demo")
       .setDescription("Something useful. No, really.")
       .setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,
                                          "test.mp4");
    

    (above code is from this sample project)

提交回复
热议问题