modified IsOnline to make it more responsive
respond to changes in network status and minimize data usage