There is no reliable way to detect if the user is definitely online or definitely offline. They could have an intermittent connection, or the status could change just after you check it. The only good way to do this is: don't check for connectivity, just attempt network operations, and handle them if they fail.