Check if active network is connected

This commit is contained in:
M66B 2019-02-10 08:05:17 +00:00
parent e7dd1a01b1
commit 56cc9043de
1 changed files with 8 additions and 1 deletions

View File

@ -706,8 +706,15 @@ public class Helper {
return null;
}
NetworkInfo ani = cm.getNetworkInfo(active);
if (log)
EntityLog.log(context, "isMetered: active info=" + cm.getNetworkInfo(active));
EntityLog.log(context, "isMetered: active info=" + ani);
if (ani == null || !ani.isConnected()) {
if (log)
EntityLog.log(context, "isMetered: active network not connected");
return null;
}
NetworkCapabilities caps = cm.getNetworkCapabilities(active);
if (caps == null) {