I've created this tethering connection but I would prefer do not share any 3G/4G connection because I need it only for access to a local web server, how I can disable access to it?
wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
Method[] wmMethods = wifi.getClass().getDeclaredMethods();
for (Method method: wmMethods){
if (method.getName().equals("setWifiApEnabled")){
try {
WifiConfiguration netConfig = new WifiConfiguration();
netConfig.SSID = "WifiConnection";
netConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
method.invoke(wifi, netConfig, true);
} catch (IllegalArgumentException e){
e.printStackTrace();
} catch (IllegalAccessException e){
e.printStackTrace();
} catch (InvocationTargetException e){
e.printStackTrace();
}
}
}
}