Establish connection to accesspoint

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Establish connection to accesspoint

Postby technique » Mon Apr 23, 2012 3:15 pm

Im trying to get a connection to a accesspoint out of my application. ive read a few examples how to do it and it seams pretty easy and self-explaining.

i tried a secured ap and an open - both didnt work. i can create the needed WifiConfiguration and and enableNetwork(int) returns true, but no connection is established.

Ingame is an open network:

Code: Select all
            WifiConfiguration wc = new WifiConfiguration();
            wc.SSID = "\"ingame\"";
            wc.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
            wc.status = WifiConfiguration.Status.ENABLED;

            int netID = wifiManager.addNetwork(wc);
            wifiManager.enableNetwork(netID, true);


But when i try to check the connection by this:

Code: Select all
          WifiInfo inf = wifiManager.getConnectionInfo();
          Log.d("Wifi", " connected to : " + inf.getSSID());
         
          ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
          NetworkInfo networkInfo = null;
          if(connectivityManager != null)
          {
             networkInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
             Log.d("Wifi", "isConnected " + networkInfo.isConnected());
          }


i get "connected to : null" and "isConnected false" - so no active connection is established.
The wpa_supplicant throws no errors (in logcat) and ive no clue what is going wrong.

the android wifi-manager (gui) shows no connection too.

any ideas?
technique
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Apr 23, 2012 2:39 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 4 guests