Android 2.2 wifi hotspot API

You can call private boolean setWifiApEnabled(WifiConfiguration wifiConfig, boolean enabled); using reflection 🙂 after getting the WifiManager use the reflection to get the WifiManager declared methods, look for this method name setWifiApEnabled and invoke it through the WifiManager object These API are marked as @hide, so currently you cannot use them directly, but they appear on … Read more

How to turn on/off wifi hotspot programmatically in Android 8.0 (Oreo)

I thought the LocalOnlyHotspot route was the way to, but as @edsappfactory.com said in the comments – it only gives closed network, no internet access. In Oreo hot-spotting/tethering moved to ConnectionManager, and its annotated @SystemApi, so (nominally) inaccessible. As part of something else I was doing, I made an app and put it on github … Read more

Android: How to Enable/Disable Wifi or Internet Connection Programmatically

I know of enabling or disabling wifi: WifiManager wifiManager = (WifiManager)this.context.getSystemService(Context.WIFI_SERVICE); wifiManager.setWifiEnabled(status); where status may be true or false as per requirement. Edit: You also need the following permissions in your manifest file: <uses-permission android:name=”android.permission.ACCESS_WIFI_STATE”/> <uses-permission android:name=”android.permission.CHANGE_WIFI_STATE”/>