Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid application Wi-Fi device - AP connectivity
    primarykey
    data
    text
    <p>I am building an application which can transfer data between a mobile and a Wi-Fi device... The mobile has got the <a href="http://en.wikipedia.org/wiki/Wireless_access_point" rel="nofollow noreferrer">AP</a> enabled (through code) and another device connects to this specific network... How can I detect through code to see the details of the devices connected to the network(AP)?** Is there a solution for this?</p> <p>I have seen an application called <em>Wifi Hot spot</em> in <a href="http://en.wikipedia.org/wiki/HTC_Desire" rel="nofollow noreferrer">HTC Desire</a> that does this functionality of showing the IP addresses of the devices connected to the network. How can this be achieved?</p> <p>Check out <em><a href="http://www.goodandevo.net/2010/05/review-sprint-mobile-hotspot-on-htc-evo-4g.html?cid=6a00d83451c9ec69e20133ef0db4e3970b" rel="nofollow noreferrer">Review: Sprint Mobile Hotspot on HTC EVO 4G</a></em>.</p> <p>It shows an application that can actually display the connected users. How can we do that programmatically? Is there an API for that?</p> <p>For creating an access point:</p> <pre><code>private void createWifiAccessPoint() { if (wifiManager.isWifiEnabled()) { wifiManager.setWifiEnabled(false); } Method[] wmMethods = wifiManager.getClass().getDeclaredMethods(); //Get all declared methods in WifiManager class boolean methodFound = false; for (Method method: wmMethods){ if (method.getName().equals("setWifiApEnabled")){ methodFound = true; WifiConfiguration netConfig = new WifiConfiguration(); netConfig.SSID = "\""+ssid+"\""; netConfig.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN); //netConfig.allowedProtocols.set(WifiConfiguration.Protocol.RSN); //netConfig.allowedProtocols.set(WifiConfiguration.Protocol.WPA); //netConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); //netConfig.preSharedKey = password; //netConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP); //netConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP); //netConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP); //netConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP); try { boolean apstatus = (Boolean) method.invoke(wifiManager, netConfig,true); //statusView.setText("Creating a Wi-Fi Network \""+netConfig.SSID+"\""); for (Method isWifiApEnabledmethod: wmMethods) { if (isWifiApEnabledmethod.getName().equals("isWifiApEnabled")){ while (!(Boolean)isWifiApEnabledmethod.invoke(wifiManager)){ }; for (Method method1: wmMethods){ if(method1.getName().equals("getWifiApState")){ int apstate; apstate = (Integer)method1.invoke(wifiManager); // netConfig = (WifiConfiguration)method1.invoke(wifi); //statusView.append("\nSSID:"+netConfig.SSID+"\nPassword:"+netConfig.preSharedKey+"\n"); } } } } if(apstatus) { System.out.println("SUCCESSdddd"); //statusView.append("\nAccess Point Created!"); //finish(); //Intent searchSensorsIntent = new Intent(this,SearchSensors.class); //startActivity(searchSensorsIntent); } else { System.out.println("FAILED"); //statusView.append("\nAccess Point Creation failed!"); } } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } if (!methodFound){ //statusView.setText("Your phone's API does not contain setWifiApEnabled method to configure an access point"); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload