Added connection detector.

Checking internet status. Fixed crash when device is offline