Main activity now listens for changes in network connectivity and shuts down if there is no network connection.