added internet connectivity check

Added the functionality to check if device is connected to the internet
before executing any task dependent on the connection