package Ġcom . example . my application Ċ Ċ import Ġandroid . annotation . Suppress Lint Ċ import Ġandroid . content . Context Ċ import Ġandroid . net . Connectivity Manager Ċ import Ġandroid . support . v 7 . app . AppCompatActivity Ċ import Ġandroid . widget . Toast Ċ Ċ class ĠNetwork Ġ{ ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġ@ Suppress Lint (" Missing Permission ") ĊĠĠĠĠĠĠĠ Ġfun Ġhay Red ( activity : ĠAppCompatActivity ): Boolean { ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġconnectivity Manager Ġ= Ġactivity . getSystem Service ( Context . CONNECT IVITY _ SERVICE ) Ġas ĠConnect ivity Manager ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġnetwork Info Ġ= Ġconnectivity Manager . active Network Info ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġnetwork Info Ġ!= Ġnull Ġ&& Ġnetwork Info . isConnected ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }