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

Apps Wifi Application

Hi frnds i am new to android application development. I have a doubt abt the wifi based android application.

Do we need to explicitly use Wifimanager in our source code for developing apps which will receive wifi data or the OS will Take care of wifi things.

plz clarifi
 
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


}

}
 
Back
Top Bottom