Created
March 23, 2018 18:40
-
-
Save adrianhall/269280b52010dbdd20dbb7f11e85665f to your computer and use it in GitHub Desktop.
Extension function to pull the connectivityManager from the context
This file contains 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
package com.amazon.aws.mobile.samples.tasks.extensions | |
import android.content.Context | |
import android.net.ConnectivityManager | |
/** | |
* Extension method to return the connectivity manager, given a context | |
*/ | |
fun Context.getConnectivityManager(): ConnectivityManager { | |
return applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment