首页 文章

如何禁用自杀网络助手进入Android设备?

提问于
浏览
4

当用户使用强制网络门户连接到开放式WiFi时,Android设备将使用强制网络门户/登录页面打开浏览器实例 .

我们想禁用它,因为我们使用应用程序进行登录 .

我遇到了CaptivePortal类到Android Marshmallow . 我可以用它来禁用网络吗?

类名:android.net.CaptivePortal

方法名称:ignoreNetwork

如何使用上述类和方法禁用WiFi上自动启动强制网络门户?

1 回答

  • 0

    试试这个:

    private void CaptivePortalDetectionEnabled() {
        if (CaptiveChange.isChecked()) {
            Settings.Global.putInt(MainActivity.this.getContentResolver(), "captive_portal_detection_enabled", 1);
            Toast.makeText(MainActivity.this, "Captive portal detection is now " + state() + "\n 網路檢查服務已\"開啟\"", Toast.LENGTH_SHORT).show();
        } else {
            Settings.Global.putInt(MainActivity.this.getContentResolver(), "captive_portal_detection_enabled", 0);
            Toast.makeText(MainActivity.this, "Captive portal detection is now " + state() + "\n 網路檢查服務已\"關閉\"", Toast.LENGTH_SHORT).show();
        }
    }
    

相关问题