Problem getting result from ssid scan

1

I'm doing applied to scan SSID, quite simple. The program is running and it's very simple, it has a button to scan, but when using this button, they do not get any results. I'll post the complete code here for you:

public class MainActivity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        }
public void getWifiInfo( Context ctxt  ) {
     int speed = 0;
     String ssid = null;
     String bssid = null; 
     String mac = "00:00:00:00:00:00";
     String netmask = "255.255.255.255";
     String gateway = "0.0.0.0";
     WifiInfo info;
     WifiManager wifi = (WifiManager) ctxt.getSystemService(Context.WIFI_SERVICE);{

    if (wifi != null) {
        info = wifi.getConnectionInfo();
        speed = info.getLinkSpeed();
        ssid = info.getSSID();
        bssid = info.getBSSID();
        mac = info.getMacAddress();
        gateway = getSigned( wifi.getDhcpInfo().gateway );
        netmask = getSigned( wifi.getDhcpInfo().netmask );

        System.out.println( "Speed : " + speed
                         + "ssid : "  + ssid 
                          + "bssid :"  + bssid 
                         + "macAddress :"  + mac
                         + "netmaskIp :" + netmask
                         + "gatewayIp :" + gateway  );
     }else{
        System.out.println( "Wi-fi is Null");
     }
  }
}

    public static String getSigned(int  ips ) {
        String ip = "";
            for (int k = 0; k < 4; k++) {
            ip = ips + (( ips >> k * 8) & 0xFF) + ".";
            }
        return ip.substring(0, ip.length() - 1);
    }
}
    
asked by anonymous 28.04.2015 / 21:00

0 answers