We've been using the WifiManager hidden API to enable Wifi tethering and create an access point. The problem now with API 26 on Android is that the tag @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED)
was added to the setWifiApEnabled
function and now that invocation returns false and the following log is printed:
W/WifiManager: PACKAGE_NAME attempted call to setWifiApEnabled enabled = true
Reading the new documentation, it says that the function is deprecated and will be removed in an upcoming release and to instead use ConnectivityManager#startTethering
if the caller has proper permission but this approach has the same problem with no TETHER_PRIVILEGED permissions. One other option presented on the documentation is the use of LocalOnlyHotspot
but this is no use to the project since the hotspot created has no Internet connectivity.
I've also tested with the startSoftAp
function from the hidden API but with no successful results since the following exception is thrown:
WifiService: Neither user 10164 nor current process has android.permission.NETWORK_STACK
Is there any workaround to activate a Wifi hotspot on newer APIs? I've also searched for alternatives to Wifi tethering but the only viable alternative seems to be Bluetooth tethering with the downside of only getting 3G speed. Wifi Aware and Wifi P2P were also considered but these have the problem of the Internet connectivity not being shared between the devices.
Any suggestions on how to approach this?