package Ġspace . tar an . ark shelf . data . network Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . net . Connectivity Manager Ċ import Ġandroid . net . Network Ċ import Ġandroid . net . Network Capabilities Ċ import Ġandroid . net . Network Request Ċ import Ġandroid . os . Build Ċ Ċ class ĠNetwork Status Impl ( private Ġval Ġcontext : ĠContext ) Ġ: ĠNetwork Status Ġ{ ĊĠĠĠ Ġprivate Ġval Ġcm Ġ= ĊĠĠĠĠĠĠĠ Ġcontext . getSystem Service ( Context . CONNECT IVITY _ SERVICE ) Ġas ĠConnect ivity Manager ĊĊĠĠĠ Ġoverride Ġfun Ġis Online (): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnetwork : ĠNetwork Ġ= Ġcm . active Network Ġ?: Ġreturn Ġfalse ĊĠĠĠĠĠĠĠ Ġval Ġnetwork Capabilities : ĠNetwork Capabilities Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcm . get Network Capabilities ( network ) Ġ?: Ġreturn Ġfalse ĊĊĠĠĠĠĠĠĠ Ġreturn Ġif Ġ( Build . VERSION . SDK _ INT Ġ>= ĠBuild . VERSION _ CODES . P ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnetwork Capabilities . has Capability ( Network Capabilities . NET _ CAP ABILITY _ INTER NET ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ&& Ġnetwork Capabilities . has Capability ( Network Capabilities . NET _ CAP ABILITY _ VALID ATED ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ&& Ġnetwork Capabilities . has Capability ( Network Capabilities . NET _ CAP ABILITY _ NOT _ SUS PEN DED ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnetwork Capabilities . has Capability ( Network Capabilities . NET _ CAP ABILITY _ INTER NET ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ&& Ġnetwork Capabilities . has Capability ( Network Capabilities . NET _ CAP ABILITY _ VALID ATED ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }