Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. fun isConnected() : Boolean
  2. {
  3. connectivity = context.getSystemService(Service.CONNECTIVITY_SERVICE) as ConnectivityManager
  4. if(connectivity != null)
  5. {
  6. info = connectivity!!.activeNetworkInfo
  7. if(info != null)
  8. {
  9. if(info!!.state == NetworkInfo.State.CONNECTED)
  10. {
  11. return true
  12. }
  13. }
  14. }
  15. return false
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement