Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected String doInBackground(String... aurl) {
- int count;
- try {
- URL url2 = new URL(aurl[0]);
- URLConnection conexion = url2.openConnection();
- conexion.connect();
- int lenghtOfFile = conexion.getContentLength();
- Log.d("ANDRO_ASYNC", "Lenght of file: " + lenghtOfFile);
- //String version = Build.USER;
- InputStream input = new BufferedInputStream(url2.openStream());
- OutputStream output = new FileOutputStream(Environment.getExternalStorageDirectory() + "/MIUIPolska_" + device + "_" + upversion + "-" + realbase + ".zip");
- byte data[] = new byte[1024];
- long total = 0;
- while (((count = input.read(data)) != -1) && (this.isCancelled()==false)){
- total += count;
- publishProgress(""+(int)((total*100)/lenghtOfFile));
- output.write(data, 0, count);
- }
- //String mixtapefilename = "miuipl_hotfix.zip";
- //String zipname = mixtapefilename;
- //String path = Environment.getExternalStorageDirectory() + "/";
- //unpackZip(path, zipname);
- output.flush();
- output.close();
- input.close();
- } catch (Exception e) {}
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement