Can someone provide better and faster way to check if Google is available in Android? I have observed that connectiontimeout doesnot stop in given time_out. rather it takes more
A broadcast receiver might come handy:
BroadcastReceiver networkStateReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(getActivity(), "Connection reset, rolling back", Toast.LENGTH_LONG).show();
}
};
It is also battery friendly.
Also dont forget to unregister it: (onDestroy())
getActivity().unregisterReceiver(networkStateReceiver);