I want to exchange data over hotspot between two android devices. I've tried to properly connection.
1st. I created portable hotspot:
Network SSID - my_hotspotSecurity - WPA PSK
Password - password
2nd. I'm attempting to connect when application is launched. Here is my code
mWifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
WifiConfiguration conf = new WifiConfiguration();
conf.SSID = "\"" + networkSSID + "\"";
conf.wepKeys[0] = "\"" + networkPass + "\"";
conf.wepTxKeyIndex = 0;
conf.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
conf.preSharedKey = "\""+ networkPass +"\"";
conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
int res = mWifiManager.addNetwork(conf);
boolean b = setWifiApEnabled(null, true);
I assume it was unsuccessfully. Then i'm trying sending data via socket. I've learned from JavaCodeGeeks. I configured SERVER_IP 192.168.49.1, SERVER_PORT:8888.
How to communicate correctly between two Android devices using hotspot?
Thanks in advance.