0

I am working on an application where I need detect if wifi avilable and connected also authenticated in my android device . I know how to detect this this using ConnectivityManager and NetworkInfo.It working fine but problem facing where wifi available and connected when we type URL for any site it goes 1st on another proxy site for user name and password to access the internet.I search around to detail my question and got a site of GSM provider http://www.du.ae/en/mobile/wifi-1 ,they are providing Wifi also,When I am in train it showing available network (Wifi) ,When i type any site it 1st it ask me user name and password for Authentication to access the internet. can I detect using code that user is connected and authenticated with Wifi ? Waiting for appreciable answer to solve my this issue . Thanks . .

aftab
  • 1,141
  • 8
  • 21
  • 40

1 Answers1

0
    NetworkInfo info = ((ConnectivityManager) mContext
            .getSystemService(Context.CONNECTIVITY_SERVICE))
            .getActiveNetworkInfo();
    if (info == null || !info.isConnected()) {
        return false;
    }
    if (info.isRoaming()) {
        return true;
    }

sem to wifi used

ANDROID: if WiFi is enabled AND active, launch an intent

Community
  • 1
  • 1
Android
  • 1,417
  • 9
  • 11