Last active
February 15, 2018 06:40
-
-
Save VarunBarad/f9bde6f004a560b54375d27ad26911c0 to your computer and use it in GitHub Desktop.
Revisions
-
Varun Barad revised this gist
Feb 8, 2018 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ public class ConnectivityHelper { public static boolean isConnectedToNetwork(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); boolean isConnected = false; @@ -9,4 +10,5 @@ public static boolean isConnectedToNetwork(Context context) { } return isConnected; } } -
Varun Barad revised this gist
Feb 8, 2018 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,12 +2,10 @@ public static boolean isConnectedToNetwork(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); boolean isConnected = false; if (connectivityManager != null) { NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo(); isConnected = (activeNetwork != null) && (activeNetwork.isConnectedOrConnecting()); } return isConnected; -
Varun Barad created this gist
Feb 6, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ public static boolean isConnectedToNetwork(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); boolean isConnected; if (connectivityManager != null) { NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo(); isConnected = (activeNetwork != null) && (activeNetwork.isConnectedOrConnecting()); } else { isConnected = false; } return isConnected; }