package Ġcom . pat ry kk os ier ad z ki . qr coder e ader . utils Ċ Ċ import Ġandroid . app . Activity Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . pm . PackageManager Ċ import Ġandroid . hardware . Camera Ċ import Ġandroid . net . Connectivity Manager Ċ import Ġandroid . net . Network Info Ċ import Ġandroid . support . v 4 . app . Activity Compat Ċ import Ġandroid . support . v 4 . content . Context Compat Ċ import Ġandroid . view . Surface Ċ Ċ object ĠDevice Utils Ġ{ ĊĊĠĠĠ Ġfun Ġhas Permission ( context : ĠContext , Ġpermission : ĠString ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠContext Compat . check Self Permission ( context , Ġpermission ) Ġ== ĠPackage Manager . PERMISSION _ GRAN TED ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġis Network Available ( context : ĠContext ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġconnectivity Manager Ġ= Ġcontext . getSystem Service ( Context . CONNECT IVITY _ SERVICE ) Ġas ĠConnect ivity Manager ĊĠĠĠĠĠĠĠ Ġval Ġactive Network Info Ġ= Ġconnectivity Manager . active Network Info ĊĠĠĠĠĠĠĠ Ġreturn Ġactive Network Info Ġ!= Ġnull Ġ&& Ġactive Network Info . isConnected ĊĠĠĠ Ġ} ĊĊ Ċ } Ċ