1. Are you ready for the Galaxy S20? Here is everything we know so far!

Wifi Application

Discussion in 'Android Development' started by chandradeor, Jul 14, 2013.

  1. chandradeor

    chandradeor Lurker
    Thread Starter

    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

    1. Download the Forums for Android™ app!


  2. Armuro

    Armuro Newbie

    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



Share This Page