I want to use ConnectivityManager.NetworkCallback()
to use to take the connected wifi SSID of the android device.
private ConnectivityManager.NetworkCallback mNetworkCallback = new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
onNetworkAvailable(network);
//I think I need to find the connected SSID in here.
}
@Override
public void onLost(Network network) {
onNetworkLost(network);
}
};
There is a method named onAvailable(Network network)
. So then I think I should find the connected SSID inside this method. But I don't know how to use this method and how to call the onAvailable(Network network)
. So what should I do for that?