Download large file on Android device -


i'm writing android-app, map application. use app, user should download offline map file. size of file 3gb... possible/good idea download such big file in app or have ask user download file on his/her pc , manualy copy file android device?

if want use android download file itself, shall use download manager perform task you:

public void startdownload(string url, string filename) {     uri resource = uri.parse(url);        downloadmanager.request request = new downloadmanager.request(resource);        request.setallowednetworktypes(request.network_wifi);        request.setallowedoverroaming(false);        //set file type      mimetypemap mimetypemap = mimetypemap.getsingleton();       string mimestring = mimetypemap.getmimetypefromextension(mimetypemap.getfileextensionfromurl(url));       request.setmimetype(mimestring);       //show notification     request.setshowrunningnotification(true);       request.setvisibleindownloadsui(true);       //set target directory     request.setdestinationinexternalpublicdir("yourcachedir", filename);       request.settitle("offline map downloading");        downloadmanager downloadmanager = (downloadmanager)getsystemservice(download_service);  ;     long id = downloadmanager.enqueue(request);     log.i(tag, "start download, id = " + id); } 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -