package Ġorg . simple . clin ic . analytics Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroid . content . Context Ċ import Ġandroid . net . Connectivity Manager Ċ import Ġandroid . net . Network Ċ import Ġandroid . net . Network Capabilities Ċ import Ġandroid . os . Build Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠNetwork Capabilities Provider Ġ@ Inject Ġconstructor ( private Ġval Ġapplication : ĠApplication ) Ġ{ ĊĊĠ Ġfun Ġactive Network Capabilities (): ĠNetwork Capabilities ? Ġ{ ĊĠĠĠ Ġval Ġconnectivity Manager Ġ= Ġapplication . getSystem Service ( Context . CONNECT IVITY _ SERVICE ) Ġas ĠConnect ivity Manager ĊĠĠĠ Ġval Ġcurrent Active Network Ġ= Ġif Ġ( Build . VERSION . SDK _ INT Ġ>= ĠBuild . VERSION _ CODES . M ) Ġ{ ĊĠĠĠĠĠ Ġconnectivity Manager . active Network ĊĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠ Ġfind Current Active Network V 2 1 ( connectivity Manager ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġreturn Ġcurrent Active Network ?. let Ġ{ Ġnetwork Ġ-> ĊĠĠĠĠĠ Ġconnectivity Manager . get Network Capabilities ( network ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġfind Current Active Network V 2 1 ( connectivity Manager : ĠConnect ivity Manager ): ĠNetwork ? Ġ{ ĊĠĠĠ Ġreturn Ġconnectivity Manager ĊĠĠĠĠĠĠĠ Ġ. all Networks ĊĠĠĠĠĠĠĠ Ġ. find Ġ{ Ġconnectivity Manager . get Network Info ( it )?. isConnected Ġ?: Ġfalse Ġ} ĊĠ Ġ} Ċ } Ċ