Skip to content

Latest commit

 

History

History
17 lines (15 loc) · 565 Bytes

ReadME_Extensions_Network.md

File metadata and controls

17 lines (15 loc) · 565 Bytes

📶 Network Extensions

Use Context?.hasNetwork() to check device's Network availability by using Context.CONNECTIVITY_SERVICE. See this example :

class MyFragment : MeowFragment<*>{
    override fun onViewCreated(savedInstanceState: Bundle?) {
        //...
        val allowCallApi = hasNetwork() 
        if (allowCallApi) {
            // Network (Wifi/Data) is active but Device maybe haven't Internet. so Call Api here.
        } else { 
            // No Network. Show error or fetch data from your local repository.
        }
    }
}