Don't use DownloadManager for Magisk

This commit is contained in:
topjohnwu
2018-07-29 22:58:22 +08:00
parent 89861eceef
commit 40b63bfebe
7 changed files with 109 additions and 99 deletions

View File

@@ -69,4 +69,17 @@ public class WebService {
return conn;
}
public static HttpURLConnection mustRequest(String address, Map<String, String> header) throws IOException {
HttpURLConnection conn;
do {
conn = WebService.request(address, header);
int total = conn.getContentLength();
if (total < 0)
conn.disconnect();
else
break;
} while (true);
return conn;
}
}