Page 1 of 1

connecting ESP-8266 to Android

Posted: Sun Sep 18, 2016 9:26 pm
by rupak426
I am trying to conenct to esp8266 through android. I tried below code on android, but not able to connect to 8266.
Can anyone help me if I am missing some configuration related to 8266.

SSID = "\"" + networkInfo.name + "\"";
password = getPassword(networkInfo.name);
wifiConfiguration.preSharedKey = "\"" + password + "\"";
wifiConfiguration.allowedKeyManagement.set(WifiConfiguration‌​.KeyMgmt.WPA_PSK);
wifiConfiguration.allowedProtocols.set(WifiConfiguration.Pro‌​tocol.WPA);
netid = wifiManager.addNetwork(wifiConfiguration);
wifiManager.enableNetwork(netid, true)
wifiManager.reconnect();

thanks,

Re: connecting ESP-8266 to Android

Posted: Wed Jun 02, 2021 8:41 pm
by milesstone
you can try this -> Really simple TCP client I have doing my android server according this GBWhatsApp manual and all is work OK

Re: connecting ESP-8266 to Android

Posted: Thu Jun 03, 2021 3:29 pm
by Openair
Try like this:
WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = null;
if (wifiManager != null)
wifiInfo = wifiManager.getConnectionInfo();
String ssid = null;
if (wifiInfo != null)
ssid = wifiInfo.getSSID(); /*you will get SSID <unknown ssid> if location turned off*/