I want to get the hotspot name while my wifi is disabled but mobile data & hotspot are enabled. I tried the below code but it is not working.
val wifiManager = getSystemService(Context.WIFI_SERVICE) as WifiManager
if (wifiManager.isWifiApEnabled) {
val ssid = wifiManager.wifiApConfiguration?.SSID
if (ssid != null) {
// Here, 'ssid' contains the SSID (name) of your hotspot
}
} else {
// Hotspot is not enabled
}