1

I have requirement where I need to turn off the hotspot, All the answers that I have seen only work if I turn the hotspot on programmatically. But in my case the user turns on the hotspot through the settings or the notification menu and only then do I have to turn it off.

I went through this answer which works fine in turning the hotspot off but the only problem is that for me to call

private void turnOffHotspot() {
if (mReservation != null) {
    mReservation.close();
}

I need to have mReservation initialised and the only way I can do it as far as I know is if turning it on first in my app.

Is there any other way to initialise WifiManager.LocalOnlyHotspotReservation without turning the hotspot On ?

basit9
  • 68
  • 1
  • 6

0 Answers0