このテザリング接続を作成しましたが、3G/4G 接続を共有したくないのは、ローカル Web サーバーへのアクセスにのみ必要なためです。アクセスを無効にするにはどうすればよいですか?
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();
}
}
}
}