Moved connection code to onResume() / onPause() instead of onStart() / onStop()