To check Wifi is connected in Android

Honestly, it has been so long not to update my blog. That's why I'm too keen to post an new interesting blog post for android. It's how to check wifi network is connected in android. It might be simple and childplay for those who has already got it but for those who didn't know yet might be interesting.

view plain print about
1public boolean isWifiConnect() {
2        ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
3        NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
4        return mWifi.isConnected();
5    }

It's very simple. How to use this one is also simple.

view plain print about
1boolean isConnected;
2isConnected = isWifiConnect();
3if (isConnected == false) {
4Toast toast = Toast.makeText(Sync.this, "Wifi is NOT connected yet", Toast.LENGTH_SHORT);
5toast.setGravity(Gravity.CENTER, 0, 0);
6toast.show();
7} else {
8Toast toast = Toast.makeText(Sync.this, "Wifi is connected yet", Toast.LENGTH_SHORT);
9toast.setGravity(Gravity.CENTER, 0, 0);
10toast.show();
11}

Dhamma Cycle is on Google play

Last Tuesday, I've launched Dhamma Cycle on Google Play. It's for those buddhism who want to keep in touch with Buddha's dhamma and want to listen while reciting. It's my so-called 4th android application.

Please help me to use my application.

Download

LINK

LINK MIRROR

Top of Page