如何禁用网络助手进入Android设备? [英] How to disable captive network assistant into android device?

查看:131
本文介绍了如何禁用网络助手进入Android设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When a user connects to an open WiFi with a Captive Portal, the Android device will open a browser instance with the captive portal/login page.

我们要禁用它,因为我们将应用程序用于登录.

We want to disable it, since we used an app for login purposes.

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

I came across the CaptivePortal Class into Android Marshmallow. Can I use it to disable network?

类名:android.net.CaptivePortal

Class Name: android.net.CaptivePortal

方法名称:ignoreNetwork

Method Name: ignoreNetwork

如何使用以上类和方法来禁用WiFi上的强制门户自动启动?

How can I use the above class and method to disable auto launch of captive portal on WiFi?

推荐答案

尝试一下:

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();
    }
}

这篇关于如何禁用网络助手进入Android设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆