wifi disconnect event
Posted
by
user986474
on Stack Overflow
See other posts from Stack Overflow
or by user986474
Published on 2012-10-30T16:55:21Z
Indexed on
2012/10/30
17:00 UTC
Read the original article
Hit count: 204
when i get disconnect event by this code :
public class WifiReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String ssid="someSsidName";
ConnectivityManager conMan = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
NetworkInfo netInfo = conMan.getActiveNetworkInfo();
WifiInfo wifiInfo = null;
if (netInfo.getType() == ConnectivityManager.TYPE_WIFI) {
//android connect to wifi
}
else{
//do somthing
}
}
}
i try to know what the ssid name when android disconnect. i mean when android disconnect from wifi i need to know it (this i can know by my code) but what i missing is the ssid name android just disconnect from.
there is a way to do that? (i know i can save the name when android connect to wifi and use this name when disconnect but this not the way i want...)
thanks in advance!
© Stack Overflow or respective owner