Git Product home page Git Product logo

Comments (3)

kkpyqt avatar kkpyqt commented on June 28, 2024

{"versionCode":2,"versionName":"1.4.12","content":"1.优化功能#2.增加功能","minSupport":1,"url":"http://47.97.213.223:8080/services/download/testDownload/app.apk"}

from appupdate.

kkpyqt avatar kkpyqt commented on June 28, 2024

这个请求返回为-1 ,在6.0 版本里,大师有解决办法没?
string mDownLoadUrl ="http://47.97.213.223:8080/services/download/testDownload/yn.apk";
URL url = new URL(mDownLoadUrl);
connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(5000); //
connection.setReadTimeout(5000);

            connection.setRequestProperty("Connection", "Keep-Alive");

// connection.setRequestProperty("Keep-Alive", "header");
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept-Encoding", "identity");

            connection.connect();

            int fileLength = connection.getContentLength();
            Log.i(TAG,"文件大小为:"+fileLength+"btye");

from appupdate.

kkpyqt avatar kkpyqt commented on June 28, 2024

已经解决,在服务器中设置response.setContentLength(
);
String fullPath = "E:/" + id +".rmvb";
File downloadFile = new File(fullPath);
response.setContentLength((int) downloadFile.length());
客户端增加
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept-Encoding", "identity");

connection.connect();

from appupdate.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.