• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Wifi Application

Use a broadcast receiver to listen to if NETWORK_STATE_CHANGED_ACTION event.

Then in your receiver:

public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub

ConnectivityManager conMngr = (ConnectivityManager)context.getSystemService(context.CONNECTIVITY_SERVICE);
android.net.NetworkInfo wifi = conMngr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
android.net.NetworkInfo mobile = conMngr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);

if (wifi.isConnected()){

Log.d(LOG_TAG, "connected to wifi");

//receive data


}

}
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones