网络切换导致下载失败

pull/914/head
wangkai 3 years ago
parent 3e2c3bc055
commit 3fc99cd01e
  1. 2
      PublicComponent/src/main/java/com/arialyy/aria/core/AriaConfig.java
  2. 2
      PublicComponent/src/main/java/com/arialyy/aria/util/NetUtils.java

@ -157,7 +157,7 @@ public class AriaConfig {
} }
} }
private boolean isNetworkAvailable() { public boolean isNetworkAvailable() {
// 获取手机所有连接管理对象(包括对wi-fi,net等连接的管理) // 获取手机所有连接管理对象(包括对wi-fi,net等连接的管理)
ConnectivityManager connectivityManager = ConnectivityManager connectivityManager =
(ConnectivityManager) getAPP().getSystemService(Context.CONNECTIVITY_SERVICE); (ConnectivityManager) getAPP().getSystemService(Context.CONNECTIVITY_SERVICE);

@ -61,7 +61,7 @@ public class NetUtils {
return true; return true;
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return AriaConfig.getInstance().isConnectedNet(); return AriaConfig.getInstance().isNetworkAvailable();
} }
ConnectivityManager cm = ConnectivityManager cm =
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);

Loading…
Cancel
Save