Added shared preferences to track wifi and data connection state.