Best way to check to see if phone has internet in order to create an offline feature

I was reading best practices somewhere about how it is best to create some form of offline functionality so that the app can still be useful, or at least not just show a blank screen,
if someone does not have internet. Is there some way to create some logic which, rather than checking for an internet connection every time, would only trigger if there is no internet connection, in order to create some function which will let a user know they are in offline mode and implimene some feature?

take a look here

I just provided an update on that thread - its doesn´t cover all situations.