You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val conn = connectionUrl.openConnection() as HttpURLConnection
conn.connect()
if (conn.responseCode == 302) {
val redirectUrl = conn.getHeaderField("Location")
。。。。。
}
或者使用 OkHttp 进行网络请求的处理,其内部会自动完成上述过程。
The text was updated successfully, but these errors were encountered:
DownApkRunnable 中使用 HttpURLConnection 进行网络请求,没有处理下载链接存在重定向的情况(很多时候会根据下载地址重定向到一个 CDN 的地址)。这个时候返回的 response 并不是一个实际的 apk 流,而是一次重定向的内容,建议对 resonse code 做一次判断,类似下面这种
或者使用 OkHttp 进行网络请求的处理,其内部会自动完成上述过程。
The text was updated successfully, but these errors were encountered: