Skip to content

Instantly share code, notes, and snippets.

@vladimirpetrovski
Created July 24, 2020 19:25
Show Gist options
  • Select an option

  • Save vladimirpetrovski/b00b24b184b0153bfc4c30de5ead182a to your computer and use it in GitHub Desktop.

Select an option

Save vladimirpetrovski/b00b24b184b0153bfc4c30de5ead182a to your computer and use it in GitHub Desktop.
val connectivityManager = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
connectivityManager.bindProcessToNetwork(null)
} else {
ConnectivityManager.setProcessDefaultNetwork(null)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment