Skip to content

Commit

Permalink
fix network check for VPN
Browse files Browse the repository at this point in the history
  • Loading branch information
heaven7 committed Aug 13, 2020
1 parent bb93f94 commit 9d23a14
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ private static boolean hasConnectedNetwork(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
NetworkCapabilities capabilities = cm.getNetworkCapabilities(cm.getActiveNetwork());
return capabilities != null && (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)
|| capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR));
|| capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)
|| capabilities.hasTransport(NetworkCapabilities.TRANSPORT_VPN));
} else {
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
return activeNetwork != null && activeNetwork.isConnected();
Expand Down

0 comments on commit 9d23a14

Please sign in to comment.