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 characters
import android.net.Uri | |
import android.os.Bundle | |
import android.util.Log | |
import androidx.annotation.IdRes | |
import androidx.fragment.app.Fragment | |
import androidx.navigation.NavDirections | |
import androidx.navigation.fragment.DialogFragmentNavigator | |
import androidx.navigation.fragment.FragmentNavigator | |
import androidx.navigation.fragment.findNavController |
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 characters
object InternetManager { | |
fun checkForInternet(context: Context): Boolean { | |
// register activity with the connectivity manager service | |
val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | |
// if the android version is equal to M | |
// or greater we need to use the | |
// NetworkCapabilities to check what type of | |
// network has the internet connection |