private void turnOnHotspot() { wifiManager.startLocalOnlyHotspot(new WifiManager.LocalOnlyHotspotCallback() { @Override public void onStarted(WifiManager.LocalOnlyHotspotReservation reservation) { super.onStarted(reservation); hotspotReservation = reservation; String key = hotspotReservation.getWifiConfiguration().preSharedKey; String ussid = hotspotReservation.getWifiConfiguration().SSID; System.out.println("KEY: "+ key); System.out.println("USSID: "+ ussid); currentConfig = hotspotReservation.getWifiConfiguration(); System.out.println("STARTED THE HOTSPOT"); } @Override public void onStopped() { super.onStopped(); System.out.println("STOPPED THE HOTSPOT"); } @Override public void onFailed(int reason) { super.onFailed(reason); System.out.println("FAILED THE HOTSPOT"); } }, new Handler()); } private void turnOffHotspot() { active = false; if (hotspotReservation != null) { hotspotReservation.close(); System.out.println("CLOSE HOTSPOT"); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)