I want to exchange data over hotspot between two android devices. I've tried to properly connection.
First, I created a portable hotspot:
Network SSID - my_hotspot
Security - WPA PSK
Password - password
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 unsuccessful. 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?