In this post I would like to propose an internet utility implementation using AAC-LiveData, which can seamlessly fulfill the needs of a DataSource(Repository) and of a View (Activity/Fragment).

DataSource’s InternetUtility needs

A DataSource’s needs are mostly quite straight forward. It would usually need to make a synchronous call to InternetUtility to check for active internet connection before making a network call.

View’s InternetUtility needs

A View would usually get it’s data from network, database or cache. To show the latest data, the view may need to initiate a reload call when an active internet connection is available.